Hello forum,

I would like to create a Macro that would deselect all row values in a Pivot Table and then select only one specific value.

The reason I need this specifically is simple: as each month, new values are added into the excel file and pivot table, I cannot update the Macro each month to deselect a specific value.

This is what I have so far:

With ActiveSheet.PivotTables("PivotTable1").PivotFields("Building ID")
.PivotItems("Building ID").Visible = True
' above is the value I want to make visible
End With

' below are the values I want to hide. These are just five of the approx. 180 values I have to hide. So the Macro itself is unnecessarily long as well
With ActiveSheet.PivotTables("PivotTable5").PivotFields("Building ID")
.PivotItems("Building ID 1").Visible = False
.PivotItems("Building ID 2").Visible = False
.PivotItems("Building ID 3").Visible = False
.PivotItems("Building ID 4").Visible = False
.PivotItems("Building ID 5").Visible = False


Many thanks for helping me out with this one!

Best regards,
Adam