check chart if specific series is there or not

  • Thread starter Thread starter daMike
  • Start date Start date
D

daMike

Hello,

I need a subroutine to check if a specific curve/series
is already on the chart or not. I tried this ...

ActiveChart.SeriesCollection(1).Name

to check the series, but the number of "SeriesCollection(!!!!)
does't rise like that: 1,2,3,4,5,6,7. There are some numbers
missing in between. I guess it depends on the history of the
chart,viz if a old series is deleted. Is there another way
to find out if a series is on the chart (not embedded)? I
work with WinXP and Excel 2002!

Thanks in advance!
daMike
 
Mike -

Try something like this:

Dim sName as String
Dim sDummy as String
Dim bSeriesExists as Boolean
sName = "My Series Name"
On Error Resume Next
sDummy = ActiveChart.SeriesCollection(sName).Name
bSeriesExists = (Err.Number = 0)
On Error Goto 0

- Jon
 
Back
Top