How do I pause a Macro for x minutes before continuing?

E

Emea training

I need to run a macro, which essentially will display one worksheet ta
for x minutes and then move on to another for x before returning to th
original one.

I know how to get the macro to loop, but I cannot see how I can paus
the Macro for x minutes ?

Has anyone any idea
 
R

Ron de Bruin

Hi

Look in the VBA help for Application.Wait

For example
Application.Wait (Now + TimeValue("0:00:03"))
 
B

Bob Phillips

an alternative

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Sub Sleep5Secs()

Sleep 5000
MsgBox "all done"

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Ron de Bruin said:
Hi

Look in the VBA help for Application.Wait

For example
Application.Wait (Now + TimeValue("0:00:03"))


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Emea training >" <<[email protected]> wrote in
message news:[email protected]...
 
D

Dave Peterson

Do you expect to do anything to that worksheet while you're displaying it?

If yes, you may want to look at Chip Pearson's notes on application.ontime.
http://www.cpearson.com/excel/ontime.htm

If no, then I'd put up a message box and just dismiss it when I was ready to
continue.

(I'd hate to have to wait for x minutes (or even x seconds).)
 
E

emea training 2

Ron - Many thanks this works fine as I wanted it for a set of graph
being projected all day.

Thanks everyone else for suggestions, they'll be useful for othe
files.

Many thanks :
 
Top