View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
bucweat bucweat is offline
external usenet poster
 
Posts: 2
Default seriescollection(name) not working in excel 2007

Hi Jon,

Thanks...I actually had something like the first block of code in mind
as a workaround, but given what you said I will try something more
along the lines of the second block of code.

Just wondering...have you used SeriesCollection(index) where index is
a name successfully with 2007?

charlie

Bucweat -

Try something like this:

* * for each oSeries in oMyChart.SeriesCollection
* * * * if oSeries.Name = "MyChartSeries" then
* * * * * * ' do what you need to do with "MyChartSeries"
* * * * * * exit for
* * * * end if
* * next

In fact, this isn't even robust enough. I've found that doing For Each in
some collections may not actually sample each item in the collection. This
is more reliable:

* * for iSeries = 1 to oMyChart.SeriesCollection.Count
* * * * set oSeries = oMyChart.SeriesCollection(iSeries)
* * * * if oSeries.Name = "MyChartSeries" then
* * * * * * ' do what you need to do with "MyChartSeries"
* * * * * * exit for
* * * * end if
* * next

- Jon