Even more wait for Gane of thrones New Season??? Noooo !!! Who in real life would like to wait… especially for Game Of Thrones πŸ˜€ No one would like to wait for any thing in real life πŸ™‚

Waiting For Game Of Thrones Season - 7

Waiting For Game Of Thrones Season – 7

Sometimes, while doing Automation in Excel Macro we require a β€œWait” or β€œSleep” function, which will hold the execution of the next statements until the specified time.

Following is the Syntax, of Wait function in Excel VBA (Macro):

Application.Wait Β  <Time>

Here Time should be in this format : HH:MM:SS

Below code will pause the Macro running till 1:45 PM

Application.Wait β€œ13:45:00”

Now if want to pause the Macro for few hours, minutes or seconds then we can use DateAdd() Function in Application.Wait function.

Application.Wait DateAdd(β€œs”, 3, Now)

In the above example, Macro will be paused for 3 Seconds.

For 3 minutes:

Application.Wait DateAdd(β€œn”, 3, Now)

Note: For Minute we should use β€œn” not β€œm”. β€œm” is for Month. For more details click here
Similarly for 3 hrs:

Application.Wait DateAdd(β€œh”, 3, Now)


Join over 10, 000+ Excel VBA Enthusiasts & get this FREE e-Book Now!