Macro runs every X minutes

mroseto

Board Regular
Joined
Jul 18, 2002
Messages
203
Hello all,

I know this is posted here, but I cant seem to get it to work. I have a macro that I want to run every 30 minutes or so. I may make it every hour, I haven't decided. After looking through all the posts on here I can't get it to work.

I know I have to use onTime but I have no idea how to make it work. Any help would be much appreciated.

Thanks

Mike
 

Some videos you may like

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

SteveO59L

Well-known Member
Joined
Apr 21, 2004
Messages
7,896
From Excel help

Example
This example runs my_Procedure 15 seconds from now.

Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"

This example runs my_Procedure at 5 P.M.

Application.OnTime TimeValue("17:00:00"), "my_Procedure"

This example cancels the OnTime setting from the previous example.

Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
Procedure:="my_Procedure", Schedule:=False
 

mroseto

Board Regular
Joined
Jul 18, 2002
Messages
203
I can get that, but how do I reset it so it runs every 30 minutes? Do I add 1 line for 30 minutes, then anouther for 60 and so on?

Thanks for you quick response.
 

SteveO59L

Well-known Member
Joined
Apr 21, 2004
Messages
7,896
Application.OnTime Now + TimeValue("00:30:00"), "my_Procedure"

will run the procedure every 30 minutes
 

mroseto

Board Regular
Joined
Jul 18, 2002
Messages
203
Ok, sorry for so many questions, but where does this go? In "This workbook" or in Module1?

Thanks again
 

Watch MrExcel Video

Forum statistics

Threads
1,109,521
Messages
5,529,326
Members
409,863
Latest member
stacy09
Top