PDA

View Full Version : Not able to assign a whole range as a series to a chart



chamster
10-29-2007, 05:48 AM
When i try the following

Dim srs As Series
For Each srs In ac.SeriesCollection
srs.Delete
Next srs
ac.SeriesCollection.Add Source:=rng
ac.SeriesCollection.Add Source:=rng.Offset(0, 2)

i get series of lengths 23 (the first one) and 24 (the second one).

I'm fairly sure it depends on the fact that the first one only contains "---" on the whole range. For some reason, the first element is dropped. How can i get around it? Why does it happen?

Bob Phillips
10-29-2007, 07:00 AM
It seems that it treats a non-numeric first cell as the range name. Try this



With ac
For Each srs In .SeriesCollection
srs.Delete
Next srs
.SeriesCollection.Add Source:=rng
.SeriesCollection(1).Values = rng
.SeriesCollection.Add Source:=rng.Offset(0, 2)
End With

chamster
10-31-2007, 06:49 AM
This did exaclty what i needed. Thanks!