Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|