F
Fred bon
Hi,
I am using Debra's sample code that she has provided in
her website (thanks for the knowledge sharing. its
awesome)
This is the code and it doesnt work with pivot tables
that talk to OLAP cubes. On Pivot tables created from a
excel list this code works fine. Anyone has any idea?
--------------
Sub HidePivotItemsVisible()
'hide all pivot items in all tables on sheet
'except last item
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.VisibleFields
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
If pi.Visible = False Then
pi.Visible = True
Else
pi.Visible = False
End If
Next
Next
pf.AutoSort xlAscending, pf.SourceName
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
I am using Debra's sample code that she has provided in
her website (thanks for the knowledge sharing. its
awesome)
This is the code and it doesnt work with pivot tables
that talk to OLAP cubes. On Pivot tables created from a
excel list this code works fine. Anyone has any idea?
--------------
Sub HidePivotItemsVisible()
'hide all pivot items in all tables on sheet
'except last item
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.VisibleFields
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
If pi.Visible = False Then
pi.Visible = True
Else
pi.Visible = False
End If
Next
Next
pf.AutoSort xlAscending, pf.SourceName
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub