I would like to write the full code in the expanding order such as the one which is using the Change event. An in this case it will refresh and the pivot tables on the worksheet. In this case the macro would be residing on each of the desire the coding is as follows:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim mh PivotTable
Dim hmk As Worksheet
Application.EnableEvents = False
For Each hmk In Application.Worksheets
For Each mh In hmk.PivotTables
mh.PivotCache.Refresh
' MsgBox ("Refreshed pivot table '" & mh.Name & "' in sheet '" & hmk.Name & "'.")
‘Use above line only for testing/confirmation.
Next mh
Next hmk
Application.EnableEvents = True
End Sub
Bookmarks