I currently use the following to automatically refresh a group of pivot tables:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim pt As PivotTable
For Each ws In ActiveWorkbook.Worksheets
For Each pt In Worksheets("QRY_Open").PivotTables
pt.PivotChache.Refresh
Next
Next
End Sub
The source data uses the RTD function and updates continuously. I would like to create a toggle button to turn the auto refresh on/off.
My VBA knowledge is very beginner. How do I make the toggle button deactivate this code which is normally always on?
Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim pt As PivotTable
For Each ws In ActiveWorkbook.Worksheets
For Each pt In Worksheets("QRY_Open").PivotTables
pt.PivotChache.Refresh
Next
Next
End Sub
The source data uses the RTD function and updates continuously. I would like to create a toggle button to turn the auto refresh on/off.
My VBA knowledge is very beginner. How do I make the toggle button deactivate this code which is normally always on?
Thanks