2016-08-31 20 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请标记为答案,如果您需要任何其他内容,请根据您的需求开一个新帖子 –