Dear Excel Forum

I also posted this in the VBA Posts - not sure if i needed to do both as it is VBA/Pivot i need help with.

I have been using the below code to change the filter on my pivot tables based on the value in another cell and all works fine. However i set up my pivots slightly different in my current file, as i need to see unique values only i have created the pivot table and selected "Add this data to the data model". Using the same code below does not seem to be working on this pivot and i wondered if someone would be able to offer some help.





Private Sub Worksheet_Calculate()
   Const strField1 As String = "Quarter"
 

    On Error Resume Next
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    
    With Sheets("XXX").PivotTables("pivottable6").PageFields(strField1)
            .ClearAllFilters
            .CurrentPage = Range("C1").Value
    End With
      
     
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    
End Sub