Hi guys,
really could use some help!
Trying to keep this simple:
I have a simple UserForm with 2 buttons. The run button sets a global variable to true and starts a loop, the cancel button just sets the global variable to false which is tested inside the loop.
Problem is: As soon as the loop is entered, the UserForm will react to nothing.Code:Option Explicit Dim blState As Boolean Private Sub CommandButton_Cancel_Click() blState = False End Sub Private Sub CommandButton_Run_Click() Dim i As Integer i = 0 blState = True While blState = True And i < 10000 Debug.Print i i = i + 1 Wend End Sub
Maybe this is the normal behavior, but I need a way to stop the loop if the user decides to cancel out.
Any ideas? That would be great!!!!
I'm attaching the Workbook.
cheers,
ray







Reply With Quote