Macro to wait for refresh data to complete before proceeding?

dpnab

New Member
Joined
Apr 12, 2022
Messages
35
Office Version
  1. 365
Platform
  1. Windows
I'm not sure if you need to see my code, but I have a few tables that are connected via ODBC and as such, update when the file is opened (PowerQuery).

I already checked "Refresh data when opening file" but that doesn't help.

What can I add so the first thing that is done is the workbook waits to refresh the data before proceeding?

Would it need to be a separate macro and then when it's done, it proceeds to run the second macro? (I have the macro running as soon as the file is opened).

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Have you unchecked the box next to "Enable background refresh" for each query that is being refreshed?

In your Queries & Connections Pane, right click over the table, select Properties, uncheck "Enable background refresh". That will allow for the data to be completely refreshed before moving to the next steps that you have set up.
 
Upvote 3
I just had the problem and had to register just so I could click the like button! Solved my issue! Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top