check chart if specific series is there or not

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
 
J

Jon Peltier

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top