ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Starting and stopping Ontime (https://www.excelbanter.com/excel-programming/358770-starting-stopping-ontime.html)

ew

Starting and stopping Ontime
 
I am currently running Ontime to run a macro every hour. The project that I
am running this for opens at 8a and closes at 9p. Is there a way to insert a
If/Then statement that would state...If the time is between 8 and 21:00 then
run update_line_currentday, else end sub.???

I would like to palce this code inside the macro that Ontime is trying to
run so that Ontime will remain running in the off time.

Thanks for any help in advance!

mudraker[_360_]

Starting and stopping Ontime
 

EW

try


If TimeValue(Now()) < TimeValue("08:00") _
Or TimeValue(Now()) TimeValue("21:00") Then
Exit Sub
End If

or


Select Case Hour(Now())
Case Not 8 To 21
Exit Sub
Case Else
Stop
End Selec

--
mudrake
-----------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...nfo&userid=247
View this thread: http://www.excelforum.com/showthread.php?threadid=53249


ew

Starting and stopping Ontime
 
The first if/then statement worked brilliantly!

"mudraker" wrote:


EW

try


If TimeValue(Now()) < TimeValue("08:00") _
Or TimeValue(Now()) TimeValue("21:00") Then
Exit Sub
End If

or


Select Case Hour(Now())
Case Not 8 To 21
Exit Sub
Case Else
Stop
End Select


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=532494




All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com