View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Scheduled Macros in Excel

You can use OnTime, but this will only set the next scheduled time.

What you could do is check the time and set the next accordingly, something
like

Sub myProc()
Dim nTime As Date
If Time < TimeValue("11:00:00") Then
nTime = TimeValue("11:00:00")
ElseIf Time < TimeValue("13:00:00") Then
nTime = TimeValue("13:00:00")
ElseIf Time < TimeValue("16:00:00") Then
nTime = TimeValue("16:00:00")
Else
nTime = 1 - Now() + TimeValue("11:00:00")
End If

Application.OnTime nTime, "myProc"
End Sub

and start the myProc off and running.

--
HTH

Bob Phillips

"Kee" wrote in message
...
Is there a way to time an Excel Macro (that will copy data from a

specified
row and paste data into another worksheet), 3 times daily?.,,, for

example
11am, 1pm and 4pm.