VBA脚本为excel气泡图添加标签

我正在试图给四个系列的图表添加标签。 该系列是标签,X,Y,尺寸。

下面的VBA脚本适用于一个系列。 但是我想绘制4个数据系列(因为我想要有不同的颜色),并且出现错误。 问题是什么?

Sub AttachLabelsToPoints() 'Dimension variables. Dim Counter As Integer, ChartName As String, xVals As String Dim rngCell As Range ' Disable screen updating while the subroutine is run. Application.ScreenUpdating = False 'Store the formula for the first series in "xVals". xVals = ActiveChart.SeriesCollection(1).Formula 'Extract the range for the data from xVals. xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _ Mid(Left(xVals, InStr(xVals, "!") - 1), 9))) xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1) Do While Left(xVals, 1) = "," xVals = Mid(xVals, 2) Loop 'Attach a label to each data point in the chart. Counter = 1 For Each rngCell In Range(xVals).SpecialCells(xlCellTypeVisible) With ActiveChart.SeriesCollection(1).Points(Counter) .HasDataLabel = True .DataLabel.Text = rngCell.Offset(0, -1).Value Counter = Counter + 1 End With Next End Sub