fiberboysa
Board Regular
- Joined
- Apr 25, 2012
- Messages
- 106
- Office Version
- 365
- Platform
- Windows
Hi allz,
I have a workbook having multiple sheets and one sheet containing Pivot Tables connected to all other data sheets. The data have one column that is common among all data sources lets say "SP" column. I need to filter one SP value on all Pivot Tables with a single click.
I can not use Slicers because the source of these Pivots are different and I cant merge these data in a single sheet so i can use slicers.
I have done it with this simple macro but I need to make it variable that if i add more data and more Pivots in this sheet the macro adjusts it self and filter all Pivots based on a value in a common column i.e. SP.
I tried to do it with getting list of all Pivots and then tried to use For loop to do it one by one on all Pivots. I got the list of all Pivots with following macro but can not proceed further because I cant get the list of all Pivot Filter Items so I can apply filter to them and my knowledge are not that as well.
Kindly have a look on this sheet and suggest a macro that can do the required. Thanks...!
I have a workbook having multiple sheets and one sheet containing Pivot Tables connected to all other data sheets. The data have one column that is common among all data sources lets say "SP" column. I need to filter one SP value on all Pivot Tables with a single click.
I can not use Slicers because the source of these Pivots are different and I cant merge these data in a single sheet so i can use slicers.
I have done it with this simple macro but I need to make it variable that if i add more data and more Pivots in this sheet the macro adjusts it self and filter all Pivots based on a value in a common column i.e. SP.
I tried to do it with getting list of all Pivots and then tried to use For loop to do it one by one on all Pivots. I got the list of all Pivots with following macro but can not proceed further because I cant get the list of all Pivot Filter Items so I can apply filter to them and my knowledge are not that as well.
Code:
Sub ListPivotsInfor()
Dim St As Worksheet
Dim NewSt As Worksheet
Dim pt As PivotTable
Dim I, K As Long
Application.ScreenUpdating = False
Set NewSt = Worksheets.Add
I = 1: K = 2
With NewSt
.Cells(I, 1) = "Name"
For Each St In ActiveWorkbook.Worksheets
For Each pt In St.PivotTables
I = I + 1
.Cells(I, 1).Value = pt.Name
Next
Next
.Activate
End With
Application.ScreenUpdating = True
End Sub
Kindly have a look on this sheet and suggest a macro that can do the required. Thanks...!