I have a workbook with two data queries. I want to have the 2nd query automatically refreshed if the first query is manually refreshed. Below is the VBA code I have so far:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Sheets("Sheet2").ListObjects("Query2").QueryTable.Refresh
Application.ScreenUpdating = True
End Sub
The problem with the above code is that it tries to refresh the 2nd query before the first is finished which causes an error. Any help with this problem would be greatly appreciated.
Thank you!