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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,064
Members
448,545
Latest member
kj9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top