How to give a time delay of less than one second in excel vba?

The Solution to How to give a time delay of less than one second in excel vba? is


You can use an API call and Sleep:

Put this at the top of your module:

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Then you can call it in a procedure like this:

Sub test()
Dim i As Long

For i = 1 To 10
    Debug.Print Now()
    Sleep 500    'wait 0.5 seconds
Next i
End Sub

~ Answered on 2013-09-04 01:17:04


Most Viewed Questions: