Macro to Select Reporting Filters in Pivots

Microsoft Excel 2010 - complete product...
July 20, 2016 at 13:38:33
Specs: Windows 7
Hi, I have a workbook with one main tab and 16 other tabs (mainly charts that are derived from pivots). The source of all pivots is the main tab.

In the main tab, one of the fields is a “Status” field that changes almost daily. This field is one of the main filters in my pivots for the charts.

I want to create a macro that would look at the filters in the pivots and mark all the statuses that are there. I have the following macro so far, but the problem is if one of these statuses is not active and thus is not in the main tab the macro runs into a bug because it can’t find that particular field.

I believe the solution would be a macro based on “if/then” that says if this reporting filter exists then select it in the report filters options.

I would appreciate the help.

With ActiveSheet.PivotTables("PivotTable1").PivotFields(" Status")
        .PivotItems("Phase 1 - Review+").Visible = True
        .PivotItems("Phase 1 - CWG+").Visible = True
        .PivotItems("Phase 5 - PIAR Review+").Visible = True
        .PivotItems("Phase 2 - Kickoff+").Visible = True
        .PivotItems("Phase 3+").Visible = True
        .PivotItems("Phase 4+").Visible = True
        .PivotItems("Phase 5+").Visible = True
        .PivotItems("Phase 5 - Implementation+").Visible = True

message edited by AngieP

See More: Macro to Select Reporting Filters in Pivots

Reply ↓  Report •

Related Solutions

Ask Question