Pivot table - linking multiple tables filter options to a single drop down

Stu_12a3

New Member
Joined
Dec 20, 2007
Messages
20
Hi All

I am looking to link the filter options on 4 pivot tables (excel 2007) (all on the same worksheet) to a single drop down box, so that when i select an item in the drop down box it changes the filters to reflect my selection.

Eg if my pivot table filter contains a list of months and i select january in a seperate drop down box then all my pivot tables change to the january filter.

I have checked the board but the answers i see dont seem to be working for me.

many thanks

Stu
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi Thanks

I have already tried this link but can't sucessfully change the code to manage the pivot tables where they all exist on the same worksheet.

Apologies but my vba ability is miserable - could someone show me how to adjust it. The code from the contextures website FT00021 attachment is shown below

many thanks

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
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 ptMain = Target

Application.EnableEvents = False

For Each pfMain In ptMain.PageFields
For Each ws In ThisWorkbook.Worksheets
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
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 ws
Next pfMain

Application.EnableEvents = True

End Sub
 
Upvote 0
Did any of y'all ever find a way around the issue whereby when one enables “Select Multiple Items” in a 'master' pagefield and picks a few criteria, the ‘slave’ pivots do not follow? I adapted the PT0021 code for my 2 sheet workbook and added a button (as in following code). Since I’m bumbling along here, borrowing code as I can, I’ve hit a wall on how to fix that. If you could give me a push in right direction, I’d appreciate it. I also posted on the Microsoft Development Network and GNT sites as a question, and once I’ve fixed, I’ll put that up too (of course giving Debra/Contextures/et al the original credit)! I’m hoping you have already addressed this and it won’t inconvenience you further to pass on to me. Best Regards, David

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
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

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