I am trying to find the last series collection index number in the clustered column chart using vba macro. eg. If I have to find the number of slide
Sub GettingLastSlideNumber()
With ActivePresentation
MsgBox .Slides(.Slides.Count).SlideNumber
End With
End Sub
in the similar way, I am trying to find the clustered column charts Last series number.
Could someone please assist me on this.
答案 0 :(得分:1)
尝试
Sub seriescounter()
Dim osld As Slide
Dim oshp As Shape
Set osld = ActivePresentation.Slides(3) 'or whatever index
For Each oshp In osld.Shapes
If oshp.HasChart Then
If oshp.Chart.ChartType = xlColumnClustered Then MsgBox oshp.Chart.SeriesCollection.Count
End If
Next oshp
End Sub
答案 1 :(得分:0)
To get the number of Series collection in a Clustered Column Chart in an Excel sheet, use the code below :
Option Explicit
Sub FindLastSeries_inChart()
Dim cht As ChartObject
Dim Series_counter As Integer
' modify "Sheet 1" Name to your needed Sheet, and "Chart 1" to your chart's name
Set cht = Sheets("Sheet1").ChartObjects("Chart 1")
Series_counter = cht.Chart.SeriesCollection.Count
MsgBox "Series count in Chart is " & Series_counter
End Sub