I was recently trying to code for a pivot table to collapse some row fields, and ran into the underlying code. It works, but I don't really understand it. I will likely have to build more code with pivot tables, so I'm hoping someone can help me understand this snippet...specifically how PF.Name collapses all of the row fields to the first one. I would've assumed that I would have to actually enter the row field I wanted the table collapsed to.
VBA Code:
With PT
For Each PF In PT.RowFields
PF.DrillTo PF.Name
Next PF
End With