PDA

View Full Version : Variables and Chart Series



ActuarySpaz
04-12-2007, 11:17 AM
Hi everyone!
Another question with charts...
Is it possible to use a variable name or array for the series in the code for creating a chart? I have tried it a few times and always get an error. I am not sure if it is just not possible, or if I am just going about it the wrong way. Thank you!

geekgirlau
04-12-2007, 06:29 PM
Yes, it is possible - can you post some code that isn't working?

ActuarySpaz
04-13-2007, 04:59 AM
Here is a sample. I want the series to be an array if possible. THANKS!


Sheets("Sheet6").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet6").Range("E12")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R2C1:R55C1"
ActiveChart.SeriesCollection(1).Values = "=Sheet3!R2C2:R55C2"
ActiveChart.SeriesCollection(1).Name = "=Sheet3!R1C11"
ActiveChart.SeriesCollection(2).XValues = "=Sheet3!R2C1:R55C1"
ActiveChart.SeriesCollection(2).Values = "=Sheet3!R2C12:R55C12"
ActiveChart.SeriesCollection(2).Name = "=Sheet3!R1C12"