Stopping an animation macro

  • Thread starter Thread starter Ray Kanner
  • Start date Start date
R

Ray Kanner

I have an animation macro that loops for a while. How
would I be able to have the user press a key and
gracefully stop the macro from running?

Thanks in advance

Ray
 
Here is the code

Private Sub Animate_Click()

Dim n As Integer, i As Integer, Response As Integer
Dim SWWidth As Variant

Application.ScreenUpdating = True

SWWidth = Range("ScrollWindow").Value
If SWWidth = 0 Or Not IsNumeric(SWWidth) Then
Beep
Range("ScrollWindow").Select
MsgBox "Scroll Window must be numeric greater than
0"
Exit Sub
End If

n = Range("AnimateLoop").Value
For i = 1 To n
Call spinWindow_SpinUp
Application.Wait (Now + TimeSerial(0, 0, Range
("WaitTime").Value))
Next i

End Sub
 
Sorry the last post was incomplete. SpinWindow is a spin
control that changes the dates on a chart so that the
animation macro loops through a chart n times using
different time periods.

Thanks

Ray Kanner


Private Sub Animate_Click()

Dim n As Integer, i As Integer, Response As Integer
Dim SWWidth As Variant

Application.ScreenUpdating = True

SWWidth = Range("ScrollWindow").Value
If SWWidth = 0 Or Not IsNumeric(SWWidth) Then
Beep
Range("ScrollWindow").Select
MsgBox "Scroll Window must be numeric greater than
0"
Exit Sub
End If

n = Range("AnimateLoop").Value
For i = 1 To n
Call spinWindow_SpinUp
Application.Wait (Now + TimeSerial(0, 0, Range
("WaitTime").Value))
Next i

End Sub
 
Back
Top