VBA chart Question

dualhcsniatpac

Board Regular
Joined
Feb 18, 2009
Messages
126
I have 1 file that will be all charts.

Another file is all data.

Do I have to OPEN the data file to populate the charts with the data that is in there??

Or will it just update??

Code:
ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlXYScatterLines
    
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).Name = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$B$1"
    ActiveChart.SeriesCollection(1).XValues = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$B$2:$B$4"
    ActiveChart.SeriesCollection(1).XValues = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$A$2:$A$4"
    ActiveChart.SeriesCollection(1).Values = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$B$2:$B$4"
    
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(2).Name = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$C$1"
    ActiveChart.SeriesCollection(2).XValues = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$A$2:$A$4"
    ActiveChart.SeriesCollection(2).Values = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$C$2:$C$4"
    
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(3).Name = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$D$1"
    ActiveChart.SeriesCollection(3).XValues = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$A$2:$A$4"
    ActiveChart.SeriesCollection(3).Values = "='[High Volume Scrap 2009.xls]Volume and Buy Back 2009'!$D$2:$D$4"

Can I do the above? I know I can but will it work without opening the High Volume Scrap 2009 file???

Thanks!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,191,118
Messages
5,984,749
Members
439,907
Latest member
Kayfabe

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