I'm attempting to manipulate a pivot table via macro, and I would like ot know if there's an easier way to do a selection. In the code below, I'm attempting shorten my list of BA Names showing, to only show "Ginger" and "Fifi" I used the macro recorder to record the process, which was to turn off the "All" and click on "Ginger" and "Fifi", but the code recorded was all about turning OFF the ones I don't want, instead of turning ON the ones I DO want. This is an exhausting way to do it, so I'm hoping someone can help me out with this. My Real data has about 100 items, and I want to choose 10, so don't want to repeat the below with 99 lines.
With ActiveSheet.PivotTables("PivotTable1").PivotFields("BA_Name")
.PivotItems("Rene").Visible = False
.PivotItems("Renee S").Visible = False
.PivotItems("Martha E").Visible = False
.PivotItems("Juan S").Visible = False
.PivotItems("Blanca").Visible = False
.PivotItems("Guadalupe G").Visible = False
.PivotItems("Kimberly R").Visible = False
.PivotItems("Michelle M").Visible = False
.PivotItems("John W").Visible = False
.PivotItems("Lydia").Visible = False
.PivotItems("Dawn D").Visible = False
.PivotItems("Shantel M").Visible = False
.PivotItems("Henry K").Visible = False
.PivotItems("Sheryl D").Visible = False
.PivotItems("Julie A").Visible = False
.PivotItems("Jo A").Visible = False
.PivotItems("Clarence").Visible = False
.PivotItems("Viola R").Visible = False
.PivotItems("(blank)").Visible = False
.PivotItems("Delores ").Visible = False
.PivotItems("Celeste").Visible = False
End With
Also, if someone could point me to a good source for learning to manipulate pivots via VBA I'd be very appreciative. Looking online helps, but I can't find a good, solid treatment of all the ways to manipulate the data via VBA, and I'd really like it.
Thanks in advance.
Bookmarks