It's because your r
variable always greater than 59
sec. (actually it's alwasys greater 90). You should change Low
and High
so that r
would never be greater 59:
Sub Wait_Random()
Dim Low As Double
Dim High As Double
Dim r as Integer
Low = 1 '<<< CHANGE AS DESIRED
High = 59 '<<< CHANGE AS DESIRED
r = Int((High - Low) * Rnd() + Low)
Application.Wait Now + TimeValue("00:00:" & CStr(r))
End Sub
Or another way you could use
Application.Wait DateAdd("s", r, Now)
to add r
seconds. In that case r
could be greater 59
.