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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,215,029
Messages
6,122,760
Members
449,095
Latest member
m_smith_solihull

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