Code: (Select All)
Do
Do
x = x + 1
Locate 1, 1: Print x
Loop Until x Mod 100 = 0 'a natural exit condition for this loop
If PauseForInput = -1 Then Exit Do
Do
y = y + 1
Locate 2, 1: Print y
Loop Until y Mod 100 = 0 'again a way for this loop to end
If PauseForInput = -1 Then Exit Do
Loop
Function PauseForInput
_KeyClear
Do
k = _KeyHit: If k > 0 Then PauseForInput = k: Exit Function
While _MouseInput: Wend: If _MouseButton(1) Then PauseForInput = -1: Exit Function
_Delay .05 'not a high priority loop here; play nice with background processes
Loop
End Function
My solution to this type little problem. See if it makes sense to you and if it's simple enough to understand.

Instead of your SLEEP statement, I swapped in a simple little pause routine that reports if the mouse was clicked or if a key was pressed. On a key press, it simply moves on to the next loop. On a mouseclick (-1), it exits the loop. It's that easy of a process.


