![]() |
VBA Pivot Table Question
I have a pivot table and some pivot items are hidden. When
I want to display them using VB code it fails. I tried both the following statements neither works. Both statements work to hide the pivot when visible = True. Any suggestions? These Work (the selected Pivot Item is hidden) Worksheets("Summary").PivotTables(1).PivotFields(" Org") _ .PivotItems("Item Name").Visible = False With ActiveSheet.PivotTables _ ("PivotTable1").PivotFields("Org") .PivotItems("Item Name").Visible = False End With These Fail (The selected pivot item is not displayed) Worksheets("Summary").PivotTables(1).PivotFields(" Org") _ .PivotItems("Item Name").Visible = True With ActiveSheet.PivotTables _ ("PivotTable1").PivotFields("Org") .PivotItems("Item Name").Visible = True End With |
VBA Pivot Table Question
Set AutoSort to manual, and you'll be able to set visible to True.
With ActiveSheet.PivotTables _ ("PivotTable1").PivotFields("Org") .AutoSort xlManual, "Org" .PivotItems("Item Name").Visible = True End With Jack Clifford wrote: I have a pivot table and some pivot items are hidden. When I want to display them using VB code it fails. I tried both the following statements neither works. Both statements work to hide the pivot when visible = True. Any suggestions? These Work (the selected Pivot Item is hidden) Worksheets("Summary").PivotTables(1).PivotFields(" Org") _ .PivotItems("Item Name").Visible = False With ActiveSheet.PivotTables _ ("PivotTable1").PivotFields("Org") .PivotItems("Item Name").Visible = False End With These Fail (The selected pivot item is not displayed) Worksheets("Summary").PivotTables(1).PivotFields(" Org") _ .PivotItems("Item Name").Visible = True With ActiveSheet.PivotTables _ ("PivotTable1").PivotFields("Org") .PivotItems("Item Name").Visible = True End With -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 05:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com