Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Single Filter to change all Pivot Tables in a Workbook

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default Single Filter to change all Pivot Tables in a Workbook

Excel 2007 PivotTable
Update Page Fields of multiple PTs.
With "Select Multiple Items".
With macro.
http://c0718892.cdn.cloudfiles.racks.../04_10_10.xlsm
Pdf preview:
http://www.mediafire.com/file/znynzumj3jn/04_10_10.pdf
For help on multiple sheets, upload your file.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default Single Filter to change all Pivot Tables in a Workbook

Hi Herbert

Regrettably, it fails each time for me with error 1004 on the line
pvi.Visible = b(r, p, 2)

--
Regards
Roger Govier

Herbert Seidenberg wrote:
Excel 2007 PivotTable
Update Page Fields of multiple PTs.
With "Select Multiple Items".
With macro.
http://c0718892.cdn.cloudfiles.racks.../04_10_10.xlsm
Pdf preview:
http://www.mediafire.com/file/znynzumj3jn/04_10_10.pdf
For help on multiple sheets, upload your file.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default Single Filter to change all Pivot Tables in a Workbook

Roger,
Could not duplicate error,
but the index numbers of the PTs were scrambled.
See Test().
Changed the line after
For u=2 to t
So now index numbers are ignored.
Same cloud link.
A collaboration on Kathy's #2 problem would be fun.
Herb


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default Single Filter to change all Pivot Tables in a Workbook

Hi Herbert

Still getting the problem.
It errors 1004, Unable to set the visible property of the pivot item.
It seems to me, that if the value of the item is already the same as
what it is trying to be set, then it errors.

Inserting 3 lines

If pvi.Name = b(r, p, 1) Then

If pvi.Visible < b(r, p, 2) Then
pvi.Visible = b(r, p, 2)
End If

End If

enables it to run through for me.

I still get problems though, as PT2 fails to get updated at all.
I think we had best take this off line.

You can email me at
roger at technology4u dot co dot uk
Change the at and dots to make valid email address


--
Regards
Roger Govier

Herbert Seidenberg wrote:
Roger,
Could not duplicate error,
but the index numbers of the PTs were scrambled.
See Test().
Changed the line after
For u=2 to t
So now index numbers are ignored.
Same cloud link.
A collaboration on Kathy's #2 problem would be fun.
Herb

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,180
Default Single Filter to change all Pivot Tables in a Workbook

Roger,
My email attempts were blocked.
The errors you correctly identified were dealt with
in the current version (find PT6).
Please download the file at the original cloud link.
Herb

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Single Filter to change all Pivot Tables in a Workbook

Roger & Herbert - thank you both for your efforts. I apologize I didn't see
these replies sooner. If you're willing to collaborate and take a look at
the 'challenge' what is the best way to get you a file? It's likely large to
get you the full extent of what I'm trying to tackle. Thank you.

"Herbert Seidenberg" wrote:

Roger,
My email attempts were blocked.
The errors you correctly identified were dealt with
in the current version (find PT6).
Please download the file at the original cloud link.
Herb

.

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Single Filter to change all Pivot Tables in a Workbook

Kathy L. wrote on 04/09/2010 18:22 ET :
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.

Did y'all ever find a way around the issue Kathy L had with PT0021? I adapted
the code for my 2 sheet workbook and added a button (as in following code).
However, I also see that when I enable &ldquo;Select Multiple Items&rdquo; in
a
pagefield and pick a few criteria, the &lsquo;slave&rsquo; pivots do not
follow
the &lsquo;master&rsquo;. Since I&rsquo;m bumbling along here, borrowing code
as
I can, I&rsquo;ve hit a wall on how to fix that. If you could give me a push
in
right direction, I&rsquo;d appreciate it. I also posted on the Microsoft
Development Network site as a question, and once I&rsquo;ve fixed, I&rsquo;ll
put that up too (of course giving Debra et al the original credit)! I&rsquo;m
hoping you have already addressed this and it won&rsquo;t inconvenience you
further to pass on to me. Best Regards, David Shugart
-------------------
Private Sub CommandButton1_Click()

On Error Resume Next
Dim ws As Worksheet
Dim wsMain As Worksheet
Dim ptMain As PivotTable
Dim pt As PivotTable
Dim pfMain As PivotField
Dim pi As PivotItem
Dim pf As PivotField

On Error Resume Next
Set wsMain = Sheets("Sales Pivot")
Set ws = Sheets("Pivots")
Set ptMain = ActiveSheet.PivotTables("PivotTable4")

Application.EnableEvents = False
Application.ScreenUpdating = False

For Each pfMain In ptMain.PageFields
If ws.Name < wsMain.Name Then
For Each pt In ws.PivotTables
pt.RefreshTable
For Each pf In pt.PageFields
If pf.Name = pfMain.Name Then
If pfMain.CurrentPage = "(All)" Then
pf.CurrentPage = "(All)"
Exit For
End If
For Each pi In pf.PivotItems
If pi.Name = pfMain.CurrentPage Then
pf.CurrentPage = pi.Name
Exit For
End If
Next pi
End If
Next pf
Next pt
End If
Next pfMain

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub
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
Create multiple sheets and pivot tables from single source dave Excel Worksheet Functions 0 June 16th 09 05:20 PM
Several Pivot Tables: Change one filter and adapt it for the other Aloha08 Excel Discussion (Misc queries) 2 June 12th 09 02:49 AM
pivot tables value filter Tim Excel Discussion (Misc queries) 1 June 10th 09 05:10 PM
Pivot Tables - filter out zero's? Beccy Excel Discussion (Misc queries) 0 September 6th 07 03:14 PM
Multiple Pivot Tables with single Page Field cscribner Excel Discussion (Misc queries) 1 May 26th 05 12:26 AM


All times are GMT +1. The time now is 01:52 AM.

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"