VBA to wait untill first refresh finishes then continue the second refresh

jjkh58

New Member
Joined
Apr 21, 2021
Messages
8
Office Version
  1. 365
  2. 2013
  3. 2011
  4. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hi guys,

I have a report that needs to be refreshed twice before I can work on other stuff.

So what I usually do is go to Data - > Refresh All Then once the first refresh is completed, I press Ctrl+Alt+F5 to refresh for the second time.

Its refreshing multiple power queries with multiple tabs. The current code that I'm using but not working are below.

All other execution must be stopped before the first refresh is completed and needs to continue for the second refresh. Again, all other execution must be stopped until the second refresh finishes. Please help! Cheers.


Sheets("Sales Data").Select
Activeworksheets.RefreshAll
DoEvents

Sheets("GP by Department").Select
Activeworksheets.RefreshAll
DoEvents
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi,​
as explained in the VBA help for RefreshAll - a must read ! - you can edit the BackgroundQuery property of each object to refresh …​
 
Upvote 0
Hi,​
as explained in the VBA help for RefreshAll - a must read ! - you can edit the BackgroundQuery property of each object to refresh …​
Hi Marc,
Thanks for your help. Im quite new to this coding area. Would you be able to explain more in detail please?. How and where exactly should I format my script? Thanks in advance
 
Upvote 0

Not by code, just editing manually the property of each object to refresh …​
 
Upvote 0
jjkh58,

I have the same dilemma you described on April 21 of last year. Did you find a good solution?

Jeff
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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