I am using code to refresh Pivots and it works, but im getting stuck with the error handler, it gives me:
object variable with block variable not set
Here is the code I am using:
Sub RefreshAllPivots()
On Error GoTo Errhandler
Dim pivotTable As pivotTable
For Each pivotTable In ActiveSheet.PivotTables
pivotTable.RefreshTable
Next
Errhandler:
MsgBox "Error Refreshing " & pivotTable.Name
MsgBox "All Pivots Refreshed"
End Sub
Many thanks