#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Pivot Items

Hi
I would like to know what code should I write to hide all the PivotItems a
PivotField might have instead of writing a line of code for each PivotItem
like this:
Worksheets("sheet3").PivotTables(1) _
.PivotFields("year").PivotItems("1998").Visible = False

Regards,
Pedro
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pivot Items

Dim pvtItm as PivotItem, i as Long
i = 0
for each pvtItm in Worksheets("sheet3").PivotTables(1) _
.PivotFields("year").Items
if i < 0 then
pvtItm.visible = False
else
pvtItm.Visible = True
end if
i = i + 1
Next

However, at least one item has to remain visible I believe. (Thus I don't
hide the first one in the above).

Debra Dalgleish's site has some good information on programming Pivot
Tables:
http://www.contextures.com/tiptech.html


--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Hi
I would like to know what code should I write to hide all the PivotItems a
PivotField might have instead of writing a line of code for each PivotItem
like this:
Worksheets("sheet3").PivotTables(1) _
.PivotFields("year").PivotItems("1998").Visible = False

Regards,
Pedro



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 - old items Goodlighting Excel Discussion (Misc queries) 2 November 12th 08 08:26 PM
top items in a pivot by page Tuxla Excel Discussion (Misc queries) 0 October 10th 08 10:28 AM
Name items in Pivot Tables? Sheila D Excel Discussion (Misc queries) 4 December 1st 06 01:54 PM
Pivot table items suepro Excel Discussion (Misc queries) 1 December 6th 05 05:01 PM
How to eliminate any new pivot Items Randy[_16_] Excel Programming 3 August 18th 04 12:37 PM


All times are GMT +1. The time now is 07: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"