[英]Line chart marker value label switching up and down
運行此宏:
Public Sub alternateLabels()
Dim ch As Chart
Dim lab As DataLabel
Dim s As Series
Dim count As Integer
' use the appropriate names for the objects and worksheets here
Set ch = ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart 1").Chart
' this should be the "cumulative" series, check with msgbox, and remove msgbox line if it's ok
Set s = ch.SeriesCollection(2)
MsgBox s.Name 'remove this line as needed
For Each lab In s.DataLabels
If count Mod 2 = 0 Then
lab.Position = xlLabelPositionAbove
Else
lab.Position = xlLabelPositionBelow
End If
count = count + 1
Next lab
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.