Excel VBA - delay function?

G

gerok

Hello!

Can anyone help me with a delay function in VBA? I need a "pause" i
running a procedure.

Thanks in advance

Georg Rokn
 
T

Tom Ogilvy

Pauses a running macro until a specified time. Returns True if the specified
time has arrived.

Important The Wait method suspends all Microsoft Excel activity and may
prevent you from performing other operations on your computer while Wait is
in effect. However, background processes such as printing and recalculation
continue.

Syntax

expression.Wait(Time)

expression Required. An expression that returns an Application object.

Time Required Variant. The time at which you want the macro to resume, in
Microsoft Excel date format.



Wait Method Example

This example pauses a running macro until 6:23 P.M. today.

Application.Wait "18:23:00"This example pauses a running macro for
approximately 10 seconds.

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTimeThis example displays a message indicating whether
10 seconds have passed.

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Time expired"
 
M

matt dunbar

popular one this

a one second delay is...


Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

matt
 

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