I am trying to update a pivot field based on a cell value and having a button run the macro. Here is what I have so far:
Sub Updatedate()
Application.ScreenUpdating = False
Dim pt As PivotTable
Dim field As PivotField
Dim NewCat As String
Set pt = Worksheets("Daily Call Stats").PivotTables("PivotTable1")
Set field = pt.PivotFields("Start Date")
NewCat = Worksheets("Daily Call Stats").Range("B1").Value
With pt
field.ClearAllFilters
field.CurrentPage = NewCat
pt.RefreshTable
End With
Application.ScreenUpdating = True
MsgBox ("The call volume report has been updated")
End Sub
I am getting an error message on this line:
field.CurrentPage = NewCat
This worked in the past when it was triggered by a change in the cell. However, anytime I touched the cell the sheet would freeze. So, I am trying to move it to change at the click of a button. Once I made the change over it stopped working.