Pivot Table Page Field

B

Barb Reinhardt

I'm trying to identify a hidden Pivot table page field. I've looked at the
..hiddenitems and the .visibleitems properties, but it appears that there is
always one .VisibleItem and the remainder are hidden. If I double click on
the page name, I can hide a field there. How do I find that name
programmatically?

I'm trying something like this

Sub FindHidden()

Dim myPivotTable As PivotTable
Dim myPageField As PivotField
Dim myHiddenItem As PivotItem
Dim myVisibleItem As PivotItem

For Each myPivotTable In ActiveSheet.PivotTables
For Each myPageField In myPivotTable.PageFields
For Each myHiddenItem In myPageField.HiddenItems
Debug.Print "Hidden", myPageField.Name, myHiddenItem.Name
Next myHiddenItem
For Each myVisibleItem In myPageField.VisibleItems
Debug.Print "Visible", myPageField.Name, myVisibleItem.Name
Next myVisibleItem
Next myPageField
Next myPivotTable
End Sub

Thanks,
Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top