当前代码假设4个系列
Sub Macro1()
ActiveChart.FullSeriesCollection(4).Select
ActiveChart.FullSeriesCollection(4).ChartType = xlArea
ActiveChart.FullSeriesCollection(4).AxisGroup = 2
End Sub
答案 0 :(得分:1)
按照BigBen的建议,您可以使用Count属性来引用最后一个系列。因此,您的宏可以按如下方式重写...
Sub Macro1()
With ActiveChart
With .FullSeriesCollection(.FullSeriesCollection.Count)
.ChartType = xlArea
.AxisGroup = 2
End With
End With
End Sub