Dynamic Chart & VBA

kennyx

New Member
Joined
Oct 12, 2007
Messages
14
I've got a table of data in a worksheet called "Charts"... the table starts in cell "B2" and the rest changes (dynamic chart).

Code:
ActiveChart.SetSourceData Source:=Sheets("Charts").Range("B2" & ":" & "Z" & numColumns), PlotBy _
        :=xlColumns

My problem is "Z" needs to be dynamic, as the number of rows will constantly change. What's the best way to tackle this?

thanks.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
what kind of dynamic chart are you looking for? xy lines, bars, etc?

They're xy lines... basically a table of historical Fund returns. Each column is a different fund, and each row is a different month.

As for dynamic charts (the solution without using VBA), for those to work you need to have a pre-existing table first... of which mine does not.
 
Upvote 0
What do you mean "you need to have a pre-existing table first"?

If you're hardcoding B2 as the upper-left corner in your table with your code, that's all the anchor you'd need for a dynamic named range as well...
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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