![]() |
Time Loop
how would I write a loop that would run until a certain time of day then
execute the rest of the macro. |
Time Loop
Don't!
Use Ontime to execute another macro with the rest of the code in at the specified time. See Chip's page at http://www.cpearson.com/excel/ontime.htm for details how to use it. -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Curt D." wrote in message ... how would I write a loop that would run until a certain time of day then execute the rest of the macro. |
Time Loop
Hi. For a similar case, I used a code like this:
' If it's later than 23:45, Wait till next day TiempoPausa = 0 Inicio = 0 If Timer = 85500 Then While Timer = 85500 DoEvents Wend ' Wait until 00:05 While Timer <= 300 DoEvents Wend End If Inicio = Timer Your_routine ' Execute your code ' Wait 15 more minutes Minutos = 15 TiempoPausa = 60 * Minutos Do While Timer < Inicio + TiempoPausa DoEvents ' Other procceses Loop Yo can use While to loopback to your code, if neccesary. |
Time Loop
Thanks Leonardo, which one would I use to have it automatically run at 11:30
pm? "Leonardo" wrote: Hi. For a similar case, I used a code like this: ' If it's later than 23:45, Wait till next day TiempoPausa = 0 Inicio = 0 If Timer = 85500 Then While Timer = 85500 DoEvents Wend ' Wait until 00:05 While Timer <= 300 DoEvents Wend End If Inicio = Timer Your_routine ' Execute your code ' Wait 15 more minutes Minutos = 15 TiempoPausa = 60 * Minutos Do While Timer < Inicio + TiempoPausa DoEvents ' Other procceses Loop Yo can use While to loopback to your code, if neccesary. |
All times are GMT +1. The time now is 01:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com