ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stopping an animation macro (https://www.excelbanter.com/excel-programming/283367-stopping-animation-macro.html)

Ray Kanner[_2_]

Stopping an animation macro
 
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

Ron de Bruin

Stopping an animation macro
 
Hi Ray

Post your code

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ray Kanner" wrote in message ...
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




No Name

Stopping an animation macro
 
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
-----Original Message-----
Hi Ray

Post your code

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ray Kanner" wrote in message

...
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



.


Ray Kanner[_2_]

Stopping an animation macro
 
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


-----Original Message-----
Hi Ray

Post your code

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ray Kanner" wrote in message

...
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



.



All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com