SAMCRO2014
Board Regular
- Joined
- Sep 3, 2015
- Messages
- 160
I recorded a macro while creating pivot table fields and the coding is quite big. I am only showing a small portion of the coding. Is there a way to reduce this?
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost Center")
.PivotItems("123744000").Visible = False
.PivotItems("123744100").Visible = False
.PivotItems("123744300").Visible = False
.PivotItems("123744301").Visible = False
.PivotItems("123744302").Visible = False
.PivotItems("123744303").Visible = False
.PivotItems("123744500").Visible = False
.PivotItems("123746100").Visible = False
.PivotItems("123746101").Visible = False
.PivotItems("123746200").Visible = False
.PivotItems("123750101").Visible = False
.PivotItems("123751000").Visible = False
.PivotItems("123751300").Visible = False
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost Center")
.PivotItems("123744000").Visible = False
.PivotItems("123744100").Visible = False
.PivotItems("123744300").Visible = False
.PivotItems("123744301").Visible = False
.PivotItems("123744302").Visible = False
.PivotItems("123744303").Visible = False
.PivotItems("123744500").Visible = False
.PivotItems("123746100").Visible = False
.PivotItems("123746101").Visible = False
.PivotItems("123746200").Visible = False
.PivotItems("123750101").Visible = False
.PivotItems("123751000").Visible = False
.PivotItems("123751300").Visible = False
End With