-
Filter more than one pivot table at one time
-
Hi larryt1940,
Welcome to ExcelFox!!
Try this one. Adjust the sheet, range, name accordingly.
Code:
Dim wksPivot As Worksheet
Dim pvtPivot As PivotTable
Dim pvtField As PivotField
Dim ManagerName As Range
Dim strField As String
Set wksPivot = Worksheets("Sheet1") '<<==adjust to suit
Set ManagerName = Worksheets("Sheet2").Range("F1") '<<==adjust to suit
strField = "Manager Name" '<<= put the pivot field name
For Each pvtPivot In wksPivot.PivotTables
pvtPivot.PivotFields(CStr(strField)).CurrentPage = ManagerName.Text
Next
-
To: ExcelFox.com Admin
Thank you very much for your help on this.
The code is a good start and I'm trying to work the bugs out as it relates to the specific pivots and workbook.
Sincerely,
larryt1940
-
Hi,
How do i run this code automatically, when changing the pivot filter value.
Thanks
Rajesh
-
Will you want to run this only when something changes in the pivot on 1 sheet? Or are you going to make change in a pivot on any sheet?
-
Hi
In sheet module
Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
'your code here
End Sub
-
This i wants to run in only one sheet. Though i tried the above code but it is giving debug window and highlighting
pvtPivot.PivotFields(CStr(strField)).CurrentPage = ManagerName.Text
-
Hi,
I thought you need to run while you change something on pivot.
Put the code in the worksheet_change event rather than Worksheet_PivotTableUpdate
-
Hi
Also got the solution on :
Sample Excel Spreadsheets - Excel Templates
Thanks
Rajesh