View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier[_8_] Roger Govier[_8_] is offline
external usenet poster
 
Posts: 376
Default Single Filter to change all Pivot Tables in a Workbook

Hi Kathy

I think the problem is that (All) is not a pivot item when the code is
cycling through the list of items belonging to a field.

If you modify Debra's code to include the following 4 lines, then it
will do what you want

For Each pf In pt.PageFields
If pf.Name = pfMain.Name Then
For Each pi In pf.PivotItems

' inserted lines
If pfMain.CurrentPage = "(All)" Then
pf.CurrentPage = "(All)"
Exit For
End If
' end of inserted lines
If pi.Name = pfMain.CurrentPage Then
pf.CurrentPage = pi.Name
Exit For
End If
Next pi
End If

I will drop Debra a note of this change, and if I am correct, then I am
sure that she will modify her file on the website.

--
Regards
Roger Govier

Kathy L. wrote:
Hello experts,
I've reviewed PT0021 Change All Page Fields sample Excel file (for 2007) on
http://www.contextures.com/excelfiles.html#Pivot and am still having trouble
with my complex workbook with several pivot tables/charts. I have found in
this sample file that it works when you choose an explicit value in the
filter, however when you re-set the filters back to 'all' or choose multiple
values, this does not apply to subsequent pivot tables and worksheets. Is
this only possible with explicit values in the main filter or can the code be
modified to work when choosing 'all'?

Also, my workbook contains several worksheets of data, and subsequent
worksheets of various pivot tables for each set of data. The field names
would be consistent across each worksheet of data, however in my ideal world,
I'd like one main set of filters for a main pivot table to control ALL pivot
tables on subsequent worksheets, which feed from a variety of data worksheets
(all in the same workbook). Am I dreaming? So far, Excel pros that I've
solicited help from using the sample file referenced above have not been able
to make this work. Thank you.