An implementation of Visual Basic that is built into Microsoft products.
Hello @Randy Avery ,
Thanks for your question.
You can refer to these following code examples:
Wait for a fixed number of seconds:
Sub WaitForSeconds()
Dim pauseTime As Long
pauseTime = 3
MsgBox "Macro will pause for " & pauseTime & " seconds. Click OK to start."
Application.Wait Now + TimeValue("00:00:03")
MsgBox "3 seconds have passed. Resuming macro!"
End Sub
Wait until a specific time:
Sub WaitUntilSpecificTime()
MsgBox "Waiting until 14:30:00..."
Application.Wait TimeValue("14:30:00")
MsgBox "It's now 2:30 PM! Resuming macro."
End Sub
Or wait inside a loop:
Sub WaitInLoop()
Dim i As Integer
For i = 1 To 5
Debug.Print "Step " & i & " at " & Now
Application.Wait Now + TimeValue("00:00:02")
Next i
MsgBox "Loop complete!"
End Sub
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.