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 calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,196,513
Messages
6,015,640
Members
441,912
Latest member
Rayna_rahman00

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