我有一张包含多个系列的图表。其中有一个系列集合,标题为“上限”。如果图表中的任何其他系列超过该阈值,则需要将其更改为虚线。运行此代码时,我收到运行时错误 438
Sub dottedlines()
Dim mySrs As Series
Dim nPts As Long
Dim d As DataLabel
Dim i As Integer
Dim srs As SeriesCollection
i = 1
For Each mySrs In ActiveChart.SeriesCollection
If mySrs.Points(i + 1).Value > srs("Upper Limit").Points(i + 1).Value Then
With mySrs.Format.Line
.Visible = msoTrue
.DashStyle = msoLineSysDash
.Weight = 1.25
End With
i = i + 1
End If
Next mySrs
End Sub