1
我想从Excel图表中删除空系列。我试过这段代码,但是if语句有问题。删除空系列VBA
Sub UpdateChart()
Dim i As Integer
For i = ActiveChart.SeriesCollection.Count To 1 Step -1
If ActiveChart.SeriesCollection(i).Values = 0 Then
ActiveChart.SeriesCollection(i).Delete
End If
Next i
End Sub
我认为该项目SeriesCollection是图表上的点的集合,因此可能再次循环该SerieCollection项目中的点并检查该点的值是否等于0? – ga56mor
甚至空数据集是数组...尝试这样:'如果UBound函数(ActiveChart.SeriesCollection(ⅰ).Values)<= 1 Then' –
是我的差,的SeriesCollection项是保存点 – ga56mor