PDA

View Full Version : [SOLVED] code executing too fast?



MINCUS1308
11-18-2014, 12:22 PM
Im just curious.....


'WHY DO THESE RESULT IN A DIFFERENT OUTPUT?


Sub ONE()
For i = 1 To 4
Application.Wait (Now + TimeValue("0:00:01"))
Beep
Next i
End Sub


Sub TWO()
Beep
Beep
Beep
Beep
End Sub

ashleyuk1984
11-18-2014, 04:07 PM
Because in sub one, you have a application.wait command with a time value of 1 second.
So it's going to run though the code, wait one second, and then run through the rest of the code.. then repeat loop.

Sub two is doing all 4 beeps... but because it's going so fast, it only appears that your hearing one.