Hi, I am trying to use VBA to only select 6 items from a filter in a Pivot table. The number of items in the filter increases weekly but I still only want to select a set number. Below is part of the code that was produced when I used Macro recorder
Sub Macro8()
'
' Macro8 Macro
'
'
ActiveSheet.PivotTables("PivotTable2").PivotFields("Work Pack Code"). _
CurrentPage = "(All)"
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Work Pack Code")
.PivotItems("0").Visible = False
.PivotItems("4").Visible = False
.PivotItems("30").Visible = False
.PivotItems("40").Visible = False
.PivotItems("105").Visible = False
.PivotItems("130").Visible = False
.PivotItems("133").Visible = False
.PivotItems("142").Visible = False
.PivotItems("200").Visible = False
.PivotItems("202").Visible = False
.PivotItems("210").Visible = False
.PivotItems("300").Visible = False
The list will increase each week with new data
I only want to show 9002 , 9003,9004 , 9005
Any help will be greatly appreciated.
Thanks,
Clyde
Bookmarks