I have an Excel workbook containing multiple Query Tables. Each table has its own data link.
To refresh the data in all the Query Tables, I want the User to click the Refresh All button on the Ribbon.
I have a block of VBA code I want to run automatically once all the tables have completed being refreshed.
If there was only one table, I could use the AfterRefresh event as a trigger for the code I want to run. For a single table, the solution posted here works well: How to run VBA code after the "Refresh All" is pressed
However, since there are multiple tables, I think this might not be a good option.
For example, let's say I set the code to be triggered by the AfterRefresh of a particular table. We'll call it "Table Green". Additionally, let's say that When that "Table Green" has finished being refreshed, one of the other tables is still in the process of being refreshed. Let's call that one "Table Blue". Since "Table Green has finished being refreshed, the code is triggered. But since "Table Blue" is still in process, the outcome is not what is wanted.
From what I have read, when using the Refresh All button there is no good way to know the order in which tables will be refreshed. Nor is there a way to know which will complete first.
Additionally, over time, the number of Query Tables within the workbook may change, e.g. a new table may get added and/or a table may get removed.
How can this be accomplished?