View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default Is there a reset shortcut

You can use the escape key something like this for interupting a loop...

Private Sub CommandButton1_Click()
Dim lng As Long
On Error GoTo ErrorHandler
Application.EnableCancelKey = xlErrorHandler
For lng = 1 To 1000000

Next lng
Exit Sub
ErrorHandler:
If Err = 18 Then
If MsgBox("Do you want to stop?", vbYesNo, "Quit?") = vbYes Then
Application.StatusBar = False
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End
Else
Resume
End If
End If
End Sub

--
HTH...

Jim Thomlinson


" wrote:

Is there a shortcut for resetting a running application.

Grabbing the mouse then going to Run-Reset seems like a cludge. Like
there's a better way.