XL2002 - SeriesCollection.Index
Dim nSRcountOrig As Long, nSRreqd As Long
nSRcountOrig = ActiveChart.SeriesCollection.Count
nSRreqd = nSRcountOrig / 2 + 1
For i = nSRcountOrig To nSRreqd Step -1
ActiveChart.SeriesCollection(i).Delete
Next
Not sure which integers you want with "/2"
try this -
dim a as long, b as long
for i = 1 to 20
a = i / 2 +1
b = i \ 2 +1
debug.? i,a,b
next
Regards,
Peter T
"Trevor Williams" wrote in
message ...
I'm getting an error using the following code - seems like I can't use
..Index
with the SeriesCollection... Is that right?
If so, what should I be using?
Thanks in advance
Trevor
---------------------------------------
ActiveSheet.ChartObjects("Chart 1").Activate
sCount = ActiveChart.SeriesCollection.Count
xCount = sCount / 2 + 1
For Each mySeries In ActiveSheet.ChartObjects("Chart
1").Chart.SeriesCollection
If mySeries.Index xCount Then
mySeries.Delete
End If
Next
|