Connection Between Two Pivot Tables

bliang

New Member
Joined
Oct 8, 2002
Messages
2
I have this problem for many years and need a big help! I have two pivot tables with identical page views. They are not using the same data source. What I need is whenever I select one page in one pivot table, anther pivot table will automatically select the same page. Is it possible by using VBA?

Thanks in advance.

Bliang
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Yes, it's possible.

I used the change event of the worksheet, something like this:

<pre>Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$B$1" Then 'Changed pagefield of PivotTable 1
Range("K1").PivotTable.PageFields(1).CurrentPage = Target.Value 'Update PT 2
ElseIf Target.Address = "$K$1" Then 'Changed pagefield of PivotTable 2
Range("B1").PivotTable.PageFields(1).CurrentPage = Target.Value 'Update PT 1
End If
Application.EnableEvents = True
End Sub</pre>This example assumes that both PT's are on the same worksheet, but, that can be adjusted.
 
Upvote 0
Thanks for the help. However, after I copy your code, it is still not working.

Please advise it.

Bliang
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,787
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top