Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Code for selecting worksheet | Excel Discussion (Misc queries) | |||
VBA Code for selecting row | Excel Discussion (Misc queries) | |||
PivotItem Delete deletes ActiveX Controls? | Excel Programming | |||
Pivotitem count | Excel Programming | |||
Debra's sample code to hide a Pivotitem | Excel Programming |