J
johnhildreth
I can't seem to figure out how XL is using the following code. I am
trying to create a scatter plot of 2 series. Sometimes I get the 2
series as desired and sometimes I get 3 series. This 3rd series is
empty (has been created, but the source data not set). I've checked
the SeriesCollection.Count property at various places during the
process. Before the first .SeriesCollection.NewSeries line the count
is 0 and immediately after it is 1 (as it should be). So it seems to
me that if the chart is created with 0 series and I want 2, then I must
create them. How can I ever get 3 with this code???
Thanks,
John
===========================================================
Charts.Add
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Duration
Plot"
ActiveChart.ChartType = xlXYScatterLines
With Charts("Duration Plot")
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = rngStartDates
.SeriesCollection(1).Values = "=Dates!R1C3:R52C3"
.SeriesCollection(1).Border.Weight = xlThin
.SeriesCollection(1).Border.ColorIndex = 11
.SeriesCollection(1).Name = "Req'd Calendar Days"
.SeriesCollection.NewSeries
.SeriesCollection(2).XValues = "=Dates!R1C1:R52C1"
.SeriesCollection(2).Values = "=Dates!R1C2:R52C2"
.SeriesCollection(2).Border.Weight = xlThick
.SeriesCollection(2).Border.ColorIndex = 7
.SeriesCollection(2).AxisGroup = 2
.SeriesCollection(2).MarkerStyle = xlNone
.SeriesCollection(2).Name = "Completion Date"
===========================================================
There is a good bit more code, but it is just formatting things.
trying to create a scatter plot of 2 series. Sometimes I get the 2
series as desired and sometimes I get 3 series. This 3rd series is
empty (has been created, but the source data not set). I've checked
the SeriesCollection.Count property at various places during the
process. Before the first .SeriesCollection.NewSeries line the count
is 0 and immediately after it is 1 (as it should be). So it seems to
me that if the chart is created with 0 series and I want 2, then I must
create them. How can I ever get 3 with this code???
Thanks,
John
===========================================================
Charts.Add
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Duration
Plot"
ActiveChart.ChartType = xlXYScatterLines
With Charts("Duration Plot")
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = rngStartDates
.SeriesCollection(1).Values = "=Dates!R1C3:R52C3"
.SeriesCollection(1).Border.Weight = xlThin
.SeriesCollection(1).Border.ColorIndex = 11
.SeriesCollection(1).Name = "Req'd Calendar Days"
.SeriesCollection.NewSeries
.SeriesCollection(2).XValues = "=Dates!R1C1:R52C1"
.SeriesCollection(2).Values = "=Dates!R1C2:R52C2"
.SeriesCollection(2).Border.Weight = xlThick
.SeriesCollection(2).Border.ColorIndex = 7
.SeriesCollection(2).AxisGroup = 2
.SeriesCollection(2).MarkerStyle = xlNone
.SeriesCollection(2).Name = "Completion Date"
===========================================================
There is a good bit more code, but it is just formatting things.