Hi
I have a pivot table with four items in an autofilter. A,F,N,M.
I want to have buttons on the dashboard that the user can click that will set the autofilter for three pivot charts to either A, or N, or M, or F.
I went in and selected show all. I then created a macro by select A, stopped the recording, went back and selected show all again and did the same for N, M, and F. The problem is when I select A, if it isn't in the show all state, I get an error. The same for all the others. Here's the error for F. The bottom line of code for "N is in yellow.
ActiveWindow.Visible = False
Windows("Force Protection - Corporate.xls").Activate
ActiveSheet.ChartObjects("Chart 38").Activate
With ActiveChart.PivotLayout.PivotTable.PivotFields("Service")
.PivotItems("A").Visible = False
.PivotItems("M").Visible = False
.PivotItems("N").Visible = False
How can I make the code work for every possible iteration of the autofilter. Thanks
I have a pivot table with four items in an autofilter. A,F,N,M.
I want to have buttons on the dashboard that the user can click that will set the autofilter for three pivot charts to either A, or N, or M, or F.
I went in and selected show all. I then created a macro by select A, stopped the recording, went back and selected show all again and did the same for N, M, and F. The problem is when I select A, if it isn't in the show all state, I get an error. The same for all the others. Here's the error for F. The bottom line of code for "N is in yellow.
ActiveWindow.Visible = False
Windows("Force Protection - Corporate.xls").Activate
ActiveSheet.ChartObjects("Chart 38").Activate
With ActiveChart.PivotLayout.PivotTable.PivotFields("Service")
.PivotItems("A").Visible = False
.PivotItems("M").Visible = False
.PivotItems("N").Visible = False
How can I make the code work for every possible iteration of the autofilter. Thanks