Hello all,
This might be a quick and easy one for some of you. I have a Macro created that refreshes two tables (these are connected to a view in SQL).
When we use the refresh all function we get a time out in sql as it tries to refresh the tables at the same time.
we are after some vba code to fit imbertween the three refresh codes (below) that force the macro to wait for each refresh to be completed before it starts the next. Simply put the three refreshes need to happen in a sequence and not at once.
Any help on this is greatly appreciated 
Sub RefreshSequence()
'Invoice Table Refresh
Sheets("INVOICED").Select
Range( _
"Table__192.168.100.20_D365_JMW_Product_Category_02[[#Headers],[SupplierAccountName]]" _
).Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
'Open Table Refresh
Sheets("ALL OPEN SALES ").Select
Range( _
"Table__192.168.100.20_D365_JMW_Products_All_Sales_Open[[#Headers],[SupplierAccountName]]" _
).Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
'Invoice Table Second Refresh
Sheets("INVOICED").Select
Range( _
"Table__192.168.100.20_D365_JMW_Product_Category_02[[#Headers],[SupplierAccountName]]" _
).Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
End Sub
Bookmarks