Codename equivalent for Series

  • Thread starter Thread starter Sandy V
  • Start date Start date
S

Sandy V

I am trying to get something like this, which obviously
fails

Sname = ActiveChart.SeriesCollection(1).CodeName

In a new unmodified chart I would expect Sname to
be "Series1". But if say Series1 has been deleted Sname
might be "Series2". I just need the number in this string.

If the Series is selected the series number (not
necessarily same as index) can be obtained with an Excel4
macro (thanks Stephen Bullen). However I am looking for
an equivalent without having to select the series.

There seems to be some similarity in the way Excel manages
both Worksheets and Series as regards to Index, Name and
CodeName. Except of course CodeName doesn't apply for
Series, but I guess something similar must be lurking.

Having searched this NG I'm not optimistic but would be
delighted if anyone has a solution.

TIA
Sandy
 
Sandy,
I'm not positive here, but I just hit "F1" while the cursor was on
SeriesCollection, and from the help file, activechart.seriescollection(1)
returns you a Series object, which has a Name property,ie
Sname = ActiveChart.SeriesCollection(1).Name, but this seems to be the only
identifier type property for the series object.

hth.


--

____________________________________________________________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
____________________________________________________________________________
________________
 
Hi Mike,

Thanks for replying. Unfortunately the series name is not
what I need.

Sname = ExecuteExcel4Macro("SELECTION()")
This XLM would return "S1" if the first original and
entire series is selected.

Typically "S1" would refer to Series(1) but not
necessarily, an observation pointed out by Jon Peltier.
I could work with series names if they were guaranteed
unique, but they are not.

To side-track, the same macro is suggested to advise users
of the selected series & point (eg "S1S4"). Whilst it
returns the correct point, the returned series index might
not be correct.

I still think a static object identifier (if that's the
right term) must exist for each series. I have
studied "Macrofun.hlp" re this and other XLM's for clues
but to no avail (a quick search finds MS's download link
for this help file).

The XLM gets what I want but only if selected.
But how does it get that identifier!

With regards,
Sandy

PS I've been monitoring but only just seen your reply
today (25th) although it's dated the 22nd, odd. I
received a "friendly notification" of it from "Developers
Dex", as I have sometimes in the past, first time one has
been useful!
 
Hi Sandy,

perhaps you can use a for each... next loop to loop through each series,
select it, and then run the xlm macro on each of the series?

Beyond that, I don't think I can help you, perhaps one of the real gurus out
there can.
 
Back
Top