Hello, I can't seem to crack this problem. I wish to select the filter on my pivot table based on another cell in another worksheet. Can anyone point me in the right direction?
The worksheet my pivot table is on is named "Undesirable Submission" and the name of the pivot table is PivotTable2.
The filter name is "Month".
The worksheet I will retrieve the filter information is named "Introduction". And the relevant cell is F3.
==
The code I have is this:
'This line stops the worksheet updating on every change
If Intersect(Target, Introduction.Range("F3")) Is Nothing Then Exit Sub
'Set the Variables to be used
Dim PTable2 as PivotTable
Dim Field As PivotField
Dim NewCat As String
'Here you amend to suit your data
Set Field = PTable2.PivotFields("Month")
NewCat = Introduction.Range("F3").Value
'This updates and refreshes the PIVOT table
With PTable2
Field.ClearAllFilters
Field.CurrentPage = NewCat
PTable2.RefreshTable
End With
End Sub
==
Thanks in advance for the help!!
The worksheet my pivot table is on is named "Undesirable Submission" and the name of the pivot table is PivotTable2.
The filter name is "Month".
The worksheet I will retrieve the filter information is named "Introduction". And the relevant cell is F3.
==
The code I have is this:
'This line stops the worksheet updating on every change
If Intersect(Target, Introduction.Range("F3")) Is Nothing Then Exit Sub
'Set the Variables to be used
Dim PTable2 as PivotTable
Dim Field As PivotField
Dim NewCat As String
'Here you amend to suit your data
Set Field = PTable2.PivotFields("Month")
NewCat = Introduction.Range("F3").Value
'This updates and refreshes the PIVOT table
With PTable2
Field.ClearAllFilters
Field.CurrentPage = NewCat
PTable2.RefreshTable
End With
End Sub
==
Thanks in advance for the help!!