ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pause in a macro (https://www.excelbanter.com/excel-programming/432681-pause-macro.html)

Darren

Pause in a macro
 
I have a series of sheets that uses a button on sheet 1 to refresh all the
data in the other sheets. I then press another button, again on sheet 1 do
the preset calculations to each sheet using a self written macro. What I want
to know is, is it possible to write a pause into a macro that will last long
enough for all the refreshing to finish before the calculations start? The
refresh usually takes about 90 seconds but this is variable according to
connection speed and time of day, etc...

JLGWhiz[_2_]

Pause in a macro
 
This will give you a 90 second pause in the macro while allowing all other
events to continue.

s = Timer + 90
Do While Timer < s
DoEvents
Loop



"Darren" wrote in message
...
I have a series of sheets that uses a button on sheet 1 to refresh all the
data in the other sheets. I then press another button, again on sheet 1 do
the preset calculations to each sheet using a self written macro. What I
want
to know is, is it possible to write a pause into a macro that will last
long
enough for all the refreshing to finish before the calculations start? The
refresh usually takes about 90 seconds but this is variable according to
connection speed and time of day, etc...




Darren

Pause in a macro
 
This is my macro:
Application.Run "Monthly_Reset_A_C"
Application.Run "Monthly_Reset_D_M"
Application.Run "Monthly_Reset_N_Z"

I want to insert: Application.Run "Refresh" to refresh all the sheets before
they get reset for the monthly figure. Doing what you explained only puts a
90 second pause before it runs the monthly reset applications, which still
run before the refresh. Where do I put your snippet to make it run in the
correct order?

"JLGWhiz" wrote:

This will give you a 90 second pause in the macro while allowing all other
events to continue.

s = Timer + 90
Do While Timer < s
DoEvents
Loop



"Darren" wrote in message
...
I have a series of sheets that uses a button on sheet 1 to refresh all the
data in the other sheets. I then press another button, again on sheet 1 do
the preset calculations to each sheet using a self written macro. What I
want
to know is, is it possible to write a pause into a macro that will last
long
enough for all the refreshing to finish before the calculations start? The
refresh usually takes about 90 seconds but this is variable according to
connection speed and time of day, etc...






All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com