Create a Macro Button to stop current Macro that is running

powellpowers

New Member
Joined
May 26, 2015
Messages
2
Hi all,

I have a macro that loops every 20 minutes as follow:

Sub Timer()


Application.Run "'Macro1"
Application.OnTime Now + TimeValue("00:20:00"), "Timer"

End Sub


Is there any way I can have a script to stop this from looping that I can assign to a clickable button?

Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
That is a very good advice.

Do you know how I could do it?

From my understanding you are suggesting that this line: Application.OnTime Now + TimeValue("00:20:00"), "Timer"

I should make Now + Timevalue("00:20:00") as a variable based on a cell in my spreadsheet, and subsequently I can change the cell to "false".

Is that right? I'm a total noob in this.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top