nocando
08-11-2009, 04:16 AM
Hi all,
I am new to this forum :hi: - and hope some of you experts can help me with this little challenge...
I need to count the number of visible items in a given pivotfield. I know I can set the pivot table up to do the count, but I don't want to alter the format of the current table.
The code below renders all items in the pivot field, but I want to exclude the hidden ones.
Sub Count_items()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = Sheets("MASTER").Range("A2").PivotTable
Set pf = pt.PageFields("team")
MsgBox pf.PivotItems.count
End Sub
Any suggestions?
I am new to this forum :hi: - and hope some of you experts can help me with this little challenge...
I need to count the number of visible items in a given pivotfield. I know I can set the pivot table up to do the count, but I don't want to alter the format of the current table.
The code below renders all items in the pivot field, but I want to exclude the hidden ones.
Sub Count_items()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = Sheets("MASTER").Range("A2").PivotTable
Set pf = pt.PageFields("team")
MsgBox pf.PivotItems.count
End Sub
Any suggestions?