I'm trying to loop through a pivot table to get only the PivotItems which are "visible" or shown as a result of a filter I have applied in the PivotItems.

I've tried using the visible property of the pivotitem, but this appears not to change based on whether a pivotitem is filtered or not.

Sub test() Dim pt As PivotTable Dim pf As PivotField Dim pi As PivotItem Dim emailString As String Set pt = ActiveSheet.PivotTables("FilteredList") Set pf = pt.PivotFields("Filter") pt.RefreshTable emailsString = "" For Each pi In pf.PivotItems If pi.Visible = True Then emailsString = emailsString + pi.Caption + ";" End If Next pi End Sub

I'm looking for another way to do this simply.. but haven't had luck searching.

Edit: here's a working file: https://gofile.io/?c=2WH2GX