Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Worksheets after ShowPages Page Field processed 1

Status
Not open for further replies.

uncled

Technical User
May 24, 2006
18
US
I've got a pivot table with All as the Page Header and am using the ShowPages method to create indiviual worksheets for each item in the Page field.

I would like to be able to select all these new worksheets and perform some formatting such as tab color, alignments, etc...on all these new sheets without having to loop through each one. Even if I looped through each one, the # items in the page field will change, so am hesistant to try to hard-code and worksheet selection formula.

I have other worksheets besides these new ones, so I can't simply cycle through all of them..I need to only cycle/select the ones created from the ShowPages method.

Thanks,
-ue
 



Do you have other PivotTables as well?

perhapse you could...
Code:
dim ws as worksheet, pt as pivottable
for each ws in worksheets
  for each pt in ws.pivottables
     with pt
        'do your formatting here
     end with
  next
next


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for the reply Skip!! Yes, I do have other pivot tables in the workbook, they each have different PivotNames. Is there a way to specify in the look just to look at the Pivot Tables that have a specific PivotName? What does Excel to when you create multiple pivot tables via the ShowPages method...does it index them based upon the PivotName? If so, could I also cycle through these via an index?

ths,
ue
 




I don't know, but you can surely find out...
Code:
dim ws as worksheet, pt as pivottable
for each ws in worksheets
  for each pt in ws.pivottables
     msgbox pt.name & " on " & pt.parent.name
  next
next

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Skip!!! Worked perfectly! Thanks for the idea...i'm a bit rusty in my vba coding and appreciate you help with these seemingly simple questions:)

-ue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top