Macro Coding for GETCHARTDATA - help?

excel_guy123

New Member
Joined
Oct 26, 2010
Messages
3
Hi guys,

Am hoping someone here can help me... I have a worksheet, from which I have created a number of charts that sit in another worksheet.

At the moment the data sitting in the data worksheet is Feb to September, but next month it needs to be Feb to October.

At the moment, I have a chart that pulls data range:

Code:
=Master!$C$1:$K$13

And then the macro needs to automatically offset the data (0, 1) - i.e. CHARTDATA needs to be $C$1:$L$13, then $C$1:$M$13.

The offset needs to happen every time I run the macro.. I've been toying with a couple of bits of code, to no avail - hoping someone can advise... this is what I have so far:

Code:
Sub Macro2()

Sheets("Charts").Select
ActiveSheet.ChartObjects("Chart 1").Activate
Set ChartData = Range(Range("D2").Offset(0, 1).End(xlToRight))
ActiveSheet.ChartObjects("Chart 1").Chart.SetSourceData Source:=ChartData

End Sub


If anyone has any suggestions I would be most grateful...
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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