Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using a worksheet code page and would like to check if the current time
of day falls between 2:00:00 PM thru 5:00:00 AM. If true, then a procedure would be executed. If false, the procedure would not run. I am having trouble with my syntax and cannot find the correct coding, function or "how to" in MS Help. I am using Excel in Office 2007 Professional. I would greatly appreciate any suggestions one might have to offer in resolving this issue. Thanking all in advance, Larry |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Dim t1 As Date, t2 As Date Dim tm As Date tm = Now ''' also uncomment each of the following starting from ''' the top to test 'tm = TimeSerial(5, 0, 0) 'tm = TimeSerial(5, 0, 1) 'tm = TimeSerial(13, 59, 59) 'tm = TimeSerial(14, 0, 0) If tm 1 Then tm = tm - Int(tm) End If If tm = TimeSerial(14, 0, 0) Or tm <= TimeSerial(5, 0, 0) Then MsgBox "Do it", , tm Else MsgBox "skip it", , tm End If End Sub Regards, Peter T "lwchapman" wrote in message ... I am using a worksheet code page and would like to check if the current time of day falls between 2:00:00 PM thru 5:00:00 AM. If true, then a procedure would be executed. If false, the procedure would not run. I am having trouble with my syntax and cannot find the correct coding, function or "how to" in MS Help. I am using Excel in Office 2007 Professional. I would greatly appreciate any suggestions one might have to offer in resolving this issue. Thanking all in advance, Larry |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe:
If Hour(Now) = 14 Or Hour(Now) < 5 Then -- Jim "lwchapman" wrote in message ... |I am using a worksheet code page and would like to check if the current time | of day falls between 2:00:00 PM thru 5:00:00 AM. If true, then a procedure | would be executed. If false, the procedure would not run. I am having | trouble with my syntax and cannot find the correct coding, function or "how | to" in MS Help. | | I am using Excel in Office 2007 Professional. | | I would greatly appreciate any suggestions one might have to offer in | resolving this issue. | | Thanking all in advance, Larry |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I subtract time where hh:mm:ss:ff (frames = 30 frames/sec) | Excel Discussion (Misc queries) | |||
Counting time-frames | Excel Discussion (Misc queries) | |||
2 Lists but different time frames. | Excel Programming | |||
check ocontrols within frames within userform | Excel Programming | |||
Calculation of Hrs and Mins from 2 Time Frames | Excel Worksheet Functions |