Insert DoEvents in your loop. There are several ways to acutally accomplish this.
This is quick and dirty. Create 2 buttons and name them (Start_Button and Stop_Button).
Put this code in the click routines:
----------------------------------------------------------------------
Private Sub Start_Button_Click()
'Starts code
Do While "" = ""
Cells(1, 1).Value = "Started"
DoEvents
Loop
End Sub
Private Sub Stop_Button_Click()
'Stops code
Cells(1, 1).Value = "Not Started"
End
End Sub
----------------------------------------------------------------------
A clean halt should have your code stopping after processing the record it's on or you may not like the results. One way to do this is to set a value that the running routine can check. Then when the running code checks this value it would know to stop after finishing current record.
|