Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Linking Page Fields for multiple pivot tables

I'm using the following code to set the page field for PivotTable2
based on whatever it's set as in PivotTable1:

Code:

Sub SetPagefield()
Application.ScreenUpdating = False
Dim pfld As PivotField
Dim Pi As PivotItem
Dim Target As Range
Set Target = Worksheets("Chris").Range("B3")

If IsEmpty(Target.Value) Then Exit Sub
Set pfld = Worksheets("Chris").PivotTables _
("PivotTable2").PageFields( _
"Month")

For Each Pi In pfld.PivotItems
If Pi.Value = Target.Text Then
pfld.CurrentPage = Pi.Value
Exit For
End If
Next

Application.ScreenUpdating = True
End Sub

The page fields in question contain month names (January, August etc),
and the code works for these, but doesn't work when I select (All)
from PivotTable1.

What am I doing wrong?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,180
Default Linking Page Fields for multiple pivot tables

Excel 2007 PivotTable
Match page field item selection
of multiple PTs.
http://c0718892.cdn.cloudfiles.racks.../04_10_10.xlsm

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Linking Page Fields for multiple pivot tables

On Apr 17, 9:57*am, Herbert Seidenberg
wrote:
Excel 2007 PivotTable
Matchpagefielditem selection
of multiple PTs.http://c0718892.cdn.cloudfiles.racks.../04_10_10.xlsm


Hello Herbert,

Many thanks for posting the link - that's exactly what I want.
However, I'm using the code in Excel 2003, and I still can't get it to
work when I select (All) from the page field - I get a the following
error:

Run-time Error '1004

Unable to set the Visible property of the PivotItem class


Each month is working perfectly though if I select them individually.

Any ideas?

Thanks again for your help!
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
How to Synchronize page fields for two or more than 2 pivot tables? [email protected] Excel Programming 1 December 3rd 07 08:34 PM
Debra Dalgleish - Pivot Tables (Change Multiple Page Fields) molinaram Excel Programming 3 June 15th 07 09:01 PM
Change Multiple Page Fields in two independent Pivot Tables Oleg Excel Worksheet Functions 1 January 18th 07 01:20 AM
linking pivot tables by page fields Nelson[_9_] Excel Programming 1 March 30th 06 02:16 PM
Filtering or linking Page Fields in an Excel Pivot Table Nick Weekes Excel Programming 0 April 27th 04 02:20 PM


All times are GMT +1. The time now is 06:36 PM.

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"