I am trying to cycle through many worksheets and update the query on each one. I cannot use RefreshAll as I think there must be some sort of time constraint on how long each one takes to update. Some of these queries take 5+ minutes.
Here's my code:
Sub Refresh_All()
Application.ScreenUpdating = False
'Cycle through worksheets
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
ActiveWorksheets.QueryTable.Refresh (False)
Next ws
Worksheets("Main").Activate
Application.ScreenUpdating = True
End Sub
I keep getting a run-time error 424. I have tried several different methods from this board but keep striking out.
I'm sure it's simple and right in front of my face. Please help!
Thanks in advance.
Here's my code:
Sub Refresh_All()
Application.ScreenUpdating = False
'Cycle through worksheets
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
ActiveWorksheets.QueryTable.Refresh (False)
Next ws
Worksheets("Main").Activate
Application.ScreenUpdating = True
End Sub
I keep getting a run-time error 424. I have tried several different methods from this board but keep striking out.
I'm sure it's simple and right in front of my face. Please help!
Thanks in advance.