final answer to run macro at certain time

  • Thread starter Thread starter as_sass
  • Start date Start date
A

as_sass

Hi!

I have searched this forum a number of times for a definite answer on
how to time macro execution, but have not found anything that helped.

Problem I have:

Run macro either at certain time(s) of day or in certain time interval
(whichever is easier).

Preferably using really easy code in which I understand what to
substitute to change the time interval, as I'm not too familiar with
the whole VBA thing.

Anybody got any (simple) ideas?

Thanks!

sass
 
I don't see a solution if you want to run items periodically with an
interval greater than a day, but for shorter intervals, look at the
Application.Ontime function

See Chip Pearson's example
http://www.cpearson.com/excel/ontime.htm

The workbook will need to remain open.
 
You could use OnTime to run a macro at a specified interval. In this
example, "Test" will run "Test2" after 10 seconds. Then, when Test2 runs, it
will call the first macro and the process repeats.


Sub Test()
Application.OnTime Now + TimeValue("00:00:10"), "Test2"
End Sub

Sub test2()
MsgBox "Hello"
Call Test
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top