MrExcel Publishing
Your One Stop for Excel Tips & Solutions

DOES ANY KNOW HOW I CAN GET A MACRO TO REFRESH EVERY HOUR...?


Posted by TED on June 19, 2001 9:01 AM

DOES ANY KNOW HOW I CAN GET A MACRO TO REFRESH EVERY HOUR...?

THANX

TED


Posted by Damon Ostrander on June 19, 2001 1:36 PM

Hi Ted,

Just use the Application.OnTime method to schedule the macro to run one hour in the future (Now + 1 hour). At the end of your macro, insert a line of code that uses the Ontime method to again run the macro one hour in the future. Thus each time your macro runs it reschedules itself one hour in the future, and runs every hour.

Damon

Posted by ted on June 20, 2001 2:49 AM

Sorry im new to this could u give me an example...
or email me a spread sheet that does this.


will the now part not change as the time is changing - if so will that mean that now + 1 will never be reached because it is alway an hour ahead...?

Ted

Posted by Doug on June 20, 2001 5:01 AM

He is saying do something like this

future=now+1
application.ontime(future, runmacro)