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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

kennyx

New Member
Joined
Oct 12, 2007
Messages
14
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

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,108
Office Version
  1. 365
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,191,228
Messages
5,985,405
Members
439,962
Latest member
max_york

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
Top