Pause Macro

  • Thread starter Thread starter Batman
  • Start date Start date
B

Batman

Back in Lotus 1-2-3 I could easily create a pause in any dialog box with
{?}. How do I do the same thing in Excel macros?
 
This is from Microsoft Visual Basic Help:

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 waitTime

This example displays a message indicating whether 10 seconds have passed.

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Time expired"
End If
 
If you want to pause for the purpose of manually manipulating data on the
worksheet, and then have the same macro resume, VBA will not support that
function. You will have to end the first sub, do your manipulation and then
start a second one. VBA provides the InputBox method and function that
allows you to insert data into the worksheet while the code is running as an
alternative to the Lotus {?}.
 

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

Back
Top