vba count series in chart in Excel
Q181. In Excel, how can I get the count of number of series in a Chart?
For example, I already have a chart ("Chart1") of Sales data. I want to get the number of series in Chart using VBA?
To do it in Excel, here is the answer:
- Option Explicit
- Sub SeriesCount()
- Dim lngSeriesCount As Long
- lngSeriesCount = ActiveSheet.ChartObjects("Chart1").Chart.SeriesCollection.Count
- End Sub
a) Line 4 - "Chart.SeriesCollection Method" is used to access the properties of the Series.