Chart data range update with VBA - Excel 2010

cwunderlich

Board Regular
Joined
Sep 24, 2010
Messages
101
I have a sheet with many different line charts. Each line chart uses source data from different sheets within the file. By default, I have the macro create all these source data / charts using all years of data. However, I want to build something which allows the user to manually enter a number of years they would like displayed on every chart. I should mention that the last cell used in the source data reference will always be the last cell (ie the number entered by the user will dictate how many years to go back from here)

For the design I was thinking something along these line:

- Loop through each chart in the sheet
- for each chart, find out what data range is being used as the source
- change the data range to start at the original last year and only go back the user-specified number of years

I am not very familiar at all with syntax to manipulate graps/charts. Does anyone know the syntax for this sort of thing?

Thank you very much.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
do you mean have the chart series refer to a named range and then change the named ranges on each sheet?
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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