I have a data table that I update with the following code
ActiveWorkbook.Connections("Query - My_Table").Refresh
This data feed the data of some pivot tables.
And I have two buttons. One to update the data table and one to update the pivot tables. I was wondering, if there any way to know when a data table has finished refreshing so I know then I can press the button to refresh the pivot tables?
Update: some people have been asking why I don't update the data table and the pivot table in the same piece of code.
The issue with that is if for example I do the following
ActiveWorkbook.Connections("Query - My_Table").Refresh
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
then the code will start updating the data table and then update the pivot table. so it doesn't wait until my data table has finished refreshing.