Pretty new to VBA. I have a workbook that has about 8 charts on a tab and there are a lot of tabs. Each chart needs to be filtered for the same values, and I'm struggling to get my macro to work. Here's what I have:
Sub ChartFilter()
'
'
'
'
For Each Chart In ActiveWorkbook.Charts
ActiveChart.Legend.Select
With ActiveChart.PivotLayout.PivotTable.PivotFields("Category1")
.PivotItems("Value1").Visible = True
.PivotItems("Value2").Visible = True
.PivotItems("Value3").Visible = True
.PivotItems("Value4").Visible = True
.PivotItems("Value5").Visible = True
.PivotItems("Value6").Visible = True
.PivotItems("Value7").Visible = True
End With
Next Chart
End Sub
Do you know where I'm going wrong?
Thanks!