2016-08-31 22 views
0

我想使用vba宏查找聚集的列圖表中的最後一個系列集合索引號碼。例如。如果我必須找到幻燈片試圖找到使用vba的PowerPoint中的圖表系列集合的數量

Sub GettingLastSlideNumber() 
 

 
    With ActivePresentation 
 
    MsgBox .Slides(.Slides.Count).SlideNumber 
 
    End With 
 

 
End Sub

在類似的方式

數量,我想找到羣集柱形圖最後序列號。

有人請幫助我。

+0

看到我的回答如下(如果我理解您的文章 - 在Excel工作表聚合柱圖中查找系列計數) –

回答

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 
0

要獲得系列收集的數量在一個Excel工作表一個簇柱狀圖,使用下面的代碼:

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 
+0

謝謝Shai。它在Excel中工作。我努力在Powerpoint圖表中找到它 –

+0

@SivaKumar請標記爲答案,如果您需要任何其他內容,請根據您的需求開一個新帖子 –