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
If Not ActiveSheet.AutoFilterMode Then