ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Pause or Stop a running Macro (https://www.excelbanter.com/excel-programming/271972-how-pause-stop-running-macro.html)

jfeka[_2_]

How to Pause or Stop a running Macro
 
I have written the following macro which has the effect
of repeating another macro every 20 seconds. You'll note
that it calls the other sub "upDateHis" and this ends
with calling this one ... in effect creating an endless
loop.


Sub rePeater()

Application.OnTime Now + TimeValue
("00:00:20"), "upDateHis"


End Sub

This is fine most of the time, but there are times when I
don't want this loop running and I'm wondering if someone
can suggest a way to either stop or pause this running
macro that I could activate through a control button in
my worksheet. (I know I can stop it by putting in a
break point in the VB code, but I'd prefer something a
bit more elegant)

What ideas do you have?

Jack


All times are GMT +1. The time now is 09:47 PM.

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