Hi, i'm a novice with VBA but am trying to get it to cycle through my pivot tables and select three items on a particular filter.
The filter is "Role" and the pivots contain info regarding multiple roles - i want a macro to change all the pivots to show only 3 specific roles. The below code works, but the filters on the pivots only have one role selected ("PSSR")
Any ideas how i can adjust my code to select all 3 items and nothing else? Thanks
![]()
Dim PT As PivotTable Dim PF As PivotField Dim PI As PivotItem Application.EnableEvents = False Application.ScreenUpdating = True Sheets("Pivots").Activate For Each PT In ActiveSheet.PivotTables For Each PF In PT.PivotFields If PF = "Role" Then PF.EnableMultiplePageItems = True For Each PI In PF.PivotItems If Not PI Like "PSSR" Or PI Like "CAM" Or PI Like "ISR" Then PI.Visible = False Else PI.Visible = True End If Next PI Else End If Next PF Next PT
Bookmarks