Debra's sample code to hide a Pivotitem
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 --------------- Thanks, Fred |
All times are GMT +1. The time now is 02:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com