I know I\'m doing something wrong here. I\'m trying to use the sleep function to delay my code, but I get \"Sub or Function not defined\" error. Any tips?
VBA does not have a Sleep function.
Sleep
You can import it from Kernel32.dll like this:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Note that this will freeze the application. You can also call DoEvents in a While loop, which won't freeze the application.
DoEvents
While