#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Time Loop

how would I write a loop that would run until a certain time of day then
execute the rest of the macro.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error 1004 in loop danpt Excel Discussion (Misc queries) 4 February 11th 10 04:02 PM
run time error 1004 in loop danpt Excel Discussion (Misc queries) 1 February 10th 10 11:45 PM
use time functions inside if loop saedeepu Excel Worksheet Functions 2 September 17th 09 12:55 PM
Loop time seems dependent on unrelated workbook - Why? Richard Excel Worksheet Functions 2 March 30th 06 11:59 PM
loop to time in 24 hours format Alvin Hansen[_2_] Excel Programming 5 February 13th 05 05:39 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"