VBA - Stop OnTime

Minkowski

Board Regular
Joined
Sep 16, 2009
Messages
157
hello everyone!
this may sound a bit silly but if i just change the time to 22:27:00
will it keep on running on 21:27:00 and then on 22:27:00?

or..if i want to delete the macro will it stop or forever running?


Code:
Sub ScheduleAProcedure()
   
    Application.OnTime TimeValue("21:27:00"), "MyMacro"

End Sub

thanks in advance
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi. Unless you have some other OnTime code that will run once at 21:27:00
 
Upvote 0
no just this one, that i want to change the time to

Code:
Sub ScheduleAProcedure()
   
    Application.OnTime TimeValue("09:30:00"), "MyMacro"

End Sub

i want to run it for 1 week and then delete the macro
so it stops

correct?
 
Upvote 0
So what you are saying is that if i just go and delete this macro
it won't make any difference
it will keep on running every morning???

yes i've read the part you send me
thanks for your time
 
Upvote 0
Well, I don't think that you have posted all of your OnTime code if the event keeps recurring. If you set an OnTime event to occur in the future then it will run unless you stop it as in the link, irrespective of whether or not you delete the code that created it.
 
Upvote 0
that is all the code nothing more.
i just tested it for 21:27:00 (to see if it works)
and now i changed the time to 09:30:00
so i haven't seen yet what will happen

thanks
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

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