How to pause for specific amount of time? (Excel/VBA)

Keng picture Keng · Oct 9, 2009 · Viewed 737.2k times · Source

I have an Excel worksheet that has the following macro. I'd like to loop it every second but danged if I can find the function to do that. Isn't it possible?

Sub Macro1()
'
' Macro1 Macro
'
Do
    Calculate
    'Here I want to wait for one second

Loop
End Sub

Answer

Ben S picture Ben S · Oct 9, 2009

Use the Wait method:

Application.Wait Now + #0:00:01#

or (for Excel 2010 and later):

Application.Wait Now + #12:00:01 AM#