Chart Macro

Viking08

Board Regular
Joined
Feb 9, 2004
Messages
120
I am building an excel worksheet and would like to be able to click a button in cell A of each row and have columns C:N appear in a line chart on the screen.

Here is the catch. Is there a macro that I can use that I can assign to multiple buttons that when ran will chart only those columns in its row?

For example, I have data in rows 5:500 and would like to be able to click on any of the buttons in a row and see only thte data from that row in teh chart.

Thanks
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Rijnsent

Well-known Member
Joined
Oct 17, 2005
Messages
1,298
Office Version
  1. 365
Platform
  1. Windows
Charting

Hej Viking08,

sure building 495 buttons under eachother is the easiest solution??? Wouldn't it be easier to, say, put a "x" in a cell and then make the chart display the data of that line?
Anyhow, some code that might help you is first of all finding the row of the button:
rw = Me.CommandButton1.TopLeftCell.Row
You'd use this row to get the right data-area for your chart. The pity is that, as far as I know, you have to put some code with each button you add...

G'luck,

Koen
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
It would be easier to use the Worksheet_SelectionChange event procedure. Then you could update the chart just by clicking a cell in column A.

Post a sample of your data and someone may be able to write some code for you.
 

Viking08

Board Regular
Joined
Feb 9, 2004
Messages
120
Here is a sample of my spreadsheet.

Thanks for your help.
Book1
ABCDEFGH
10COMMON AREA MAINT HQ1,8771,8771,8771,8771,8751,877
11COMMON AREA MAINT BR2000000
12COMMON AREA MAINT NB000000
13COMMON AREA MAINT BR6272272272272272272
14COMMON AREA MAINT BR115465305305301,061530
15COMMON AREA MAINT HQ000000
Sheet1
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,028
No need for VBA. See
Dynamic Charts
http://www.tushar-mehta.com/excel/newsgroups/dynamic_charts/index.html

specifically, example 4. Of course, you will have to adjust the OFFSET arguments to refer to data in a row rather than in a column.

Viking08 said:
I am building an excel worksheet and would like to be able to click a button in cell A of each row and have columns C:N appear in a line chart on the screen.

Here is the catch. Is there a macro that I can use that I can assign to multiple buttons that when ran will chart only those columns in its row?

For example, I have data in rows 5:500 and would like to be able to click on any of the buttons in a row and see only thte data from that row in teh chart.

Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,118,038
Messages
5,569,801
Members
412,293
Latest member
RJSCHILLER
Top