MichaelSchulz
Board Regular
- Joined
- Apr 10, 2014
- Messages
- 64
I want to have a block of VBA code run after all the tables in the workbook have refreshed:
The code used for one table, set in ThisWorkbook:
- User clicks the Refresh All button which causes
- All tables in the workbook to be refreshed
- four tables, each on a separate sheet
- tables are refreshed via Power Query
- Once all tables have completed the refresh, the VBA code runs
The code used for one table, set in ThisWorkbook:
VBA Code:
Option Explicit
Private WithEvents QT as QueryTable
Private Sub Workbook_Open()
Set QT = Sheet1.ListObjects(1).QueryTable
End Sub
Private Sub QT_AfterRefresh(ByVal Success As Boolean)
If Success Then
[I][block of code to be run after refresh completes][/I]
End If
End Sub