![]() |
Finding series index if I know the Series Name
I have the following code to find the series index #, but it's not working.
What am I doing wrong. Dim Series As Series Dim SeriesNum As Integer Dim SeriesName As String SeriesName = "Y axis Labels" Debug.Print CHARTNAME.SeriesCollection.Count For Each Series In CHARTNAME.SeriesCollection 'On Error Resume Next Debug.Print Series.Name Debug.Print Series.Index <~~~~it doesn't like this. If Series.Name = SeriesName Then Debug.Print Series.Index Exit For End If Next Series Thanks! |
Finding series index if I know the Series Name
Hi,
There is no index property. You would need to increment your own counter. The order is dependent on 3 things. ChartType, Plot/Series Order and Axis. What exactly are you trying to achieve? Cheers Andy Barb Reinhardt wrote: I have the following code to find the series index #, but it's not working. What am I doing wrong. Dim Series As Series Dim SeriesNum As Integer Dim SeriesName As String SeriesName = "Y axis Labels" Debug.Print CHARTNAME.SeriesCollection.Count For Each Series In CHARTNAME.SeriesCollection 'On Error Resume Next Debug.Print Series.Name Debug.Print Series.Index <~~~~it doesn't like this. If Series.Name = SeriesName Then Debug.Print Series.Index Exit For End If Next Series Thanks! -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Finding series index if I know the Series Name
You could also try the .PlotOrder of the series.
- Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Andy Pope" wrote in message ... Hi, There is no index property. You would need to increment your own counter. The order is dependent on 3 things. ChartType, Plot/Series Order and Axis. What exactly are you trying to achieve? Cheers Andy Barb Reinhardt wrote: I have the following code to find the series index #, but it's not working. What am I doing wrong. Dim Series As Series Dim SeriesNum As Integer Dim SeriesName As String SeriesName = "Y axis Labels" Debug.Print CHARTNAME.SeriesCollection.Count For Each Series In CHARTNAME.SeriesCollection 'On Error Resume Next Debug.Print Series.Name Debug.Print Series.Index <~~~~it doesn't like this. If Series.Name = SeriesName Then Debug.Print Series.Index Exit For End If Next Series Thanks! -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
All times are GMT +1. The time now is 07:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com