好吧,我跑到堆栈溢出太快了。我自己想出了一个解决方法,所以我会把它贴在这里。不能保证它很漂亮!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim pvtfield As PivotField
Dim cnt As Long
Dim i As Long
Dim srs As Series
Dim index As Long
Worksheets("Brand Pivot Table").ChartObjects("Turn By Date").Activate
cnt = ActiveChart.PivotLayout.PivotTable.PivotFields("Brand").PivotItems.Count
For i = 1 To cnt
If ActiveChart.PivotLayout.PivotTable.PivotFields("Brand").PivotItems(i).Visible = True Then
index = 1
For Each srs In ActiveChart.FullSeriesCollection
If InStr(srs.Name, "Turnover") <> 0 Then
ActiveChart.FullSeriesCollection(index).AxisGroup = 2
End If
index = index + 1
Next srs
End If
Next i