bobaol
Board Regular
- Joined
- Jun 3, 2002
- Messages
- 225
- Office Version
- 365
- 2003 or older
- Platform
- Windows
Hello, I am using a macro to refresh the PowerQuery connected to a MS SQL Server. My question, how do I make sure the data is refreshed before continuing to the next step? Depending on the size of my dataset, it may take very little time, or it may take a few seconds. I want to make sure all the data is refreshed before continuing to the next step of copy-past as values, and do other stuff. any help is appreciated. thanks in advance. here's my code:
VBA Code:
Sub Macro41____refresh_tables_()
'refresh data
ActiveWorkbook.Connections("Query - Cohort").Refresh
ActiveWorkbook.Connections("Query - vwScreeningPatientList").Refresh
'''select all, paste as values
Application.Goto Reference:="R1C1"
ActiveCell.Columns("A:AZ").EntireColumn.Select
Selection.Copy
Sheets("Values").Select
Application.Goto Reference:="R1C1"
Selection.PasteSpecial Paste:=xlPasteValues
End Sub