GPSPOW
asked on
How to make a VBA pause until a Refresh has completed.
The following code will go to a tab in a spreadsheet, refresh the data and then return to the Dashboard when the refresh is finished.
The problem I am having is that the cursor returns to the Dashboard before the Refresh is finished and the user thinks he can make another selection. When another selection is made, he either gets a warning that the refresh is still running does he want to cancel or continue with the refresh. Or sometimes he gets a Run Time Error.
What can I add below make it so that the cursor does not go back to the dashboard until the Refresh has completed?
If Range("R1") = "Update Master Patient List" Then
ActiveWorkbook.Sheets("Med itechData" ).Activate
If Not ActiveSheet.AutoFilterMode Then
ActiveSheet.Range("A5").Au toFilter
End If
Range("C1").Select
ActiveWorkbook.RefreshAll
ActiveWorkbook.Sheets("Das hboard").A ctivate
Range("B8").Select
End If
Thanks
Glen
The problem I am having is that the cursor returns to the Dashboard before the Refresh is finished and the user thinks he can make another selection. When another selection is made, he either gets a warning that the refresh is still running does he want to cancel or continue with the refresh. Or sometimes he gets a Run Time Error.
What can I add below make it so that the cursor does not go back to the dashboard until the Refresh has completed?
If Range("R1") = "Update Master Patient List" Then
ActiveWorkbook.Sheets("Med
If Not ActiveSheet.AutoFilterMode
ActiveSheet.Range("A5").Au
End If
Range("C1").Select
ActiveWorkbook.RefreshAll
ActiveWorkbook.Sheets("Das
Range("B8").Select
End If
Thanks
Glen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome and I'm glad I was able to help.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013
ASKER
glen