Link to home
Start Free TrialLog in
Avatar of scsnow2310
scsnow2310

asked on

Amend all Pivot Tables in Workbook

Hi Experts!

Please help! I've got a workbook with lots of Pivot Tables, and would like to set the PivotFields and PivotItems across all of them.  I've specified the values in the code below, but I can't get this to run.

Thanks,

Steve
Sub AmendAllPivs()

Dim pt As PivotTable
    
    For Each pt In ActiveSheet.PivotTables

    pt.PivotFields ("Product Name")
        .PivotItems("0").Visible = False
        .PivotItems("DIS01").Visible = False
    pt.PivotFields ("LTV Band")
        .PivotItems("85").Visible = False
        .PivotItems("90").Visible = False
        .PivotItems("95").Visible = False
        .PivotItems("100").Visible = False
        .PivotItems("0").Visible = False
    End With
    Next pt

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scsnow2310
scsnow2310

ASKER

Many thanks!