Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot table question. Jim W Excel Discussion (Misc queries) 3 March 12th 09 11:52 PM
Pivot Table question Beverly Darvill[_2_] Charts and Charting in Excel 1 February 11th 09 12:29 AM
Pivot Table Question John Calder New Users to Excel 2 April 23rd 08 12:54 AM
pivot table question Sanj Excel Worksheet Functions 1 September 1st 06 12:27 AM
Pivot Table Question : If statment in Pivot Table?? seve Excel Discussion (Misc queries) 2 November 22nd 05 01:00 AM


All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"