Vba count series in chart in Excel
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.