Microsoft KB Archive/46519

From BetaArchive Wiki


Excel: Using the WAIT() Macro Function

Last reviewed: November 2, 1994
Article ID: Q46519

SUMMARY

The WAIT() macro function in Microsoft Excel suspends the execution of a macro, allowing you to introduce a pause or delay. The WAIT() function takes an argument in the form of a serial number. The macro resumes execution at the time specified by the serial number.

The following is a method for specifying a pause:

  1. Calculate the duration of the desired pause in serial number form, that is, as a decimal fraction of one day, as in the following example:

       Time Interval        Serial Number Form
       -------------        ------------------
    
        1 day               1
        1 hour              1/24 = 0.04166667
        1 minute            1/(24*60) = 0.00069444
        1 second            1/(24*60*60) = 0.000011574
       10 seconds           10/(24*60*60) = 0.00011574
    
  2. Add that time to the present time by entering the WAIT() function, as follows:

          =WAIT(NOW()+0.00011574)

    You also can combine the steps in one statement, as in the following example:

          =WAIT(NOW()+10/(24*60*60)

    Both of these macro statements pause the macro for 10 seconds and then resume.


KBCategory: kbother

KBSubcategory:

Additional reference words: 1.00 1.03 1.04 1.06 1.50 2.20


Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.