标注系列的最后一点

我有一个代码,将图表上每个系列中的最后一个点改为图例名称。 不过,我不希望前四个系列的最后一点变成传说名称。 有没有人有任何build议,改变这个代码跳过前4个系列,并标出每个系列的最后一点?

For Each mySrs In ActiveChart.SeriesCollection 'change this function so every series after series 4 changes ast point With mySrs nPts = .Points.Count mySrs.Points(nPts).ApplyDataLabels _ Type:=xlDataLabelsShowValue, _ AutoText:=True, LegendKey:=False mySrs.Points(nPts).DataLabel.Text = mySrs.Name mySrs.Points(nPts).DataLabel.Orientation = 90 mySrs.Points(nPts).DataLabel.Font.Bold = True End With Next 

Excel中的图表Series有一个名为PlotOrder的属性,告诉您每个系列在图表上绘制的顺序。 你可以在你的循环中检查这个属性,只有当它> 4才能继续。 例如:

 For Each mySrs In ActiveChart.SeriesCollection With mySrs If .PlotOrder > 4 Then nPts = .Points.Count .... End If End With Next