LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting a PivotItem in code

Im looking for a way to loop through the items in a PivotField object.
Each item (a page field) should be selected and the results of the
pivot table printed out. For example, if the page field in a pivot
table were named "Fruit" and had three pivot items "Apples",
"Oranges", "Pears"; the code would select "Apples" and print the
results of the pivot table, select "Oranges" and print the results of
the pivot table, etc...
There's one caveat to this tho. The list of pivot items is not the
same every time. Sometimes it may only contain "Apples", "Pears";
other times it may only contain "Oranges", "Pears".
Ideally I'd like the code to go something like this...

Dim intCount as integer
With PivotTables("Table1")
For intCount = 1 to .PivotFields("Fruit").PivotItems.Count
.PivotFields("Fruit").PivotItems(intCount).Select
'Print code goes here.
Next intCount
End With

Unfortunately, there is no Select method for the PivotItem class.
When i use the macro recorder, it uses the CurrentPage property of the
PivotFields class. The CurrentPage property causes problems because if
the item isnt in the list, it renames the current item to the name i
was trying to select (its a read/write property instead of a read only
property).
Any help is appreciated and other ideas are welcome. Thanks in
advance.
 
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
VBA Code for selecting worksheet Marie Bayes Excel Discussion (Misc queries) 5 January 11th 07 12:37 PM
VBA Code for selecting row [email protected] Excel Discussion (Misc queries) 2 June 9th 05 10:44 PM
PivotItem Delete deletes ActiveX Controls? GoatieEddie Excel Programming 0 January 26th 04 11:41 AM
Pivotitem count Jesse[_4_] Excel Programming 3 December 28th 03 09:19 PM
Debra's sample code to hide a Pivotitem Fred bon Excel Programming 0 August 7th 03 02:48 AM


All times are GMT +1. The time now is 03:12 AM.

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

About Us

"It's about Microsoft Excel"