#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default On_timer Q

The code below, was taken from Chip Pearsons web site on On-Timers.
How could I tailor it so that the StartTimer only runs at 10:00am each
24 hours but only between two variable dates that are held in Sheet1
A1 & B1?

Thanks


Public RunWhen As Double
Public Const cRunIntervalSeconds = 1440 ' 24 Hours
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=True
End Sub

Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default On_timer Q

Public RunWhen As Double
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run

Sub StartTimer()
With Worksheets("Sheet1")
If .Range("A1").Value <= Date - 1 And _
.Range("B1").Value Date Then
RunWhen = Date + 1 + TimeSerial(10,0,0)
Application.OnTime EarliestTime:=RunWhen, _
Procedu=cRunWhat, _
Schedule:=True
End If
End With
End Sub

Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Sean" wrote in message
ups.com...
The code below, was taken from Chip Pearsons web site on On-Timers.
How could I tailor it so that the StartTimer only runs at 10:00am each
24 hours but only between two variable dates that are held in Sheet1
A1 & B1?

Thanks


Public RunWhen As Double
Public Const cRunIntervalSeconds = 1440 ' 24 Hours
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=True
End Sub

Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default On_timer Q

On Sep 11, 10:13 pm, "Bob Phillips" wrote:
Public RunWhen As Double
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run

Sub StartTimer()
With Worksheets("Sheet1")
If .Range("A1").Value <= Date - 1 And _
.Range("B1").Value Date Then
RunWhen = Date + 1 + TimeSerial(10,0,0)
Application.OnTime EarliestTime:=RunWhen, _
Procedu=cRunWhat, _
Schedule:=True
End If
End With
End Sub

Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Sean" wrote in message

ups.com...



The code below, was taken from Chip Pearsons web site on On-Timers.
How could I tailor it so that the StartTimer only runs at 10:00am each
24 hours but only between two variable dates that are held in Sheet1
A1 & B1?


Thanks


Public RunWhen As Double
Public Const cRunIntervalSeconds = 1440 ' 24 Hours
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run


Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=True
End Sub


Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub- Hide quoted text -


- Show quoted text -


Bob, many thanks once gain for your reply. Will try this out tomorrow


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default On_timer Q

On Sep 11, 10:22 pm, Sean wrote:
On Sep 11, 10:13 pm, "Bob Phillips" wrote:





Public RunWhen As Double
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run


Sub StartTimer()
With Worksheets("Sheet1")
If .Range("A1").Value <= Date - 1 And _
.Range("B1").Value Date Then
RunWhen = Date + 1 + TimeSerial(10,0,0)
Application.OnTime EarliestTime:=RunWhen, _
Procedu=cRunWhat, _
Schedule:=True
End If
End With
End Sub


Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"Sean" wrote in message


oups.com...


The code below, was taken from Chip Pearsons web site on On-Timers.
How could I tailor it so that the StartTimer only runs at 10:00am each
24 hours but only between two variable dates that are held in Sheet1
A1 & B1?


Thanks


Public RunWhen As Double
Public Const cRunIntervalSeconds = 1440 ' 24 Hours
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run


Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat,
Schedule:=True
End Sub


Sub The_Sub()
'''''''''''''''''
' Your Code Here
'''''''''''''''''
StartTimer
End Sub- Hide quoted text -


- Show quoted text -


Bob, many thanks once gain for your reply. Will try this out tomorrow- Hide quoted text -

- Show quoted text -


Bob, I've tried it with some very simple Clear Contents code at 08:55
but nothing happened, not sure why. Code as below

Public RunWhen As Double
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run
Sub StartTimer()
With Worksheets("Week")
If .Range("A1").Value <= Date - 1 And _
.Range("A2").Value Date Then
RunWhen = Date + 1 + TimeSerial(8, 55, 0)
Application.OnTime EarliestTime:=RunWhen, _
Procedu=cRunWhat, _
Schedule:=True
End If
End With
End Sub
Sub The_Sub()
Sheets("Week").Select
ActiveSheet.Unprotect

Range("C87:D88").Select
Selection.ClearContents

StartTimer
End Sub

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



All times are GMT +1. The time now is 03:29 PM.

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

About Us

"It's about Microsoft Excel"