making a chart using data from lots of sheets

JordanGoodchild

New Member
Joined
Jul 21, 2010
Messages
28
i want to make a chart that uses data from several sheets. the data is in the same spot on every sheet i.e. range("E2").

is there a general way in VBA to do this. so far i have:

Code:
    Charts.Add
    ActiveChart.ChartType = xlXYScatterLines
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox1.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox2.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox3.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox4.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox5.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox6.Value).Range("E2")
    ActiveChart.SetSourceData Source:=Sheets("" & Me.ComboBox7.Value).Range("E2")
    ActiveChart.SeriesCollection(1).Name = "Protiens"
    ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="" & Me.TextBox1.Value

Each combobox picks the sheets that are available.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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