Count Down Loop

C

Charlotte E

This should be easy, but somehow, I can't get the hang of it ... :-/

I need to have a macro pause for 2 minutes, but I need the user to know how
much more to wait.


So, I figured I wanted to make a loop that shows the remaing time it the
statusbar, i.e. something like:

Application.statusbar = "Waiting for data collecting: 00:02:00"

and then it should proceed to:

Application.statusbar = "Waiting for data collecting: 00:01:59"

Etc...

And of cause, when the time was up, the macro should continue :)


I'm not sure if 2 minutes are gonna be enough for the ERP system to finish
up, so my macro can continue, so some way of easy althering the time (maybe
by using a constant for the time) would also be apriciated :)


TIA,
 
P

Patrick Molloy

Dim t As Double
t = Timer
Do
diff = Timer - t
Application.StatusBar = Int(120 - diff)
DoEvents
Loop While diff < 120 'seconds
 
C

Charlotte E

Perfect :)

Thanks, PaTRICK ;-)




Patrick said:
Dim t As Double
t = Timer
Do
diff = Timer - t
Application.StatusBar = Int(120 - diff)
DoEvents
Loop While diff < 120 'seconds
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top