Deselect all items in a pivot table using vba

calendar_today Asked Dec 7, 2012
thumb_up 6 upvotes
history Updated April 16, 2026

Question posted 2012 · +5 upvotes

Can some quicly explain the way to deselect all items in a newly created pivot table so that I can go back and select only one or two items? I tried the following:

.PivotItems("(Select All)").Visible = False

Thanks.

Accepted answer +6 upvotes

This is probably the closest you can get to what you want:

Dim i As Long
.PivotItems(1).Visible = True
For i = 2 To .PivotItems.Count
    .PivotItems(i).Visible = False
Next

This will make the very first option the only selected option (assuming this is within a with that points to the pivotfield). If you know what you want before hand… modify accordingly.

Top excel-vba Q&A (6)

+6 upvotes ranks this answer #114 out of 136 excel-vba solutions on this site .