A
accsys
Hello
I have a clock macro in an excel worksheet that I would like it to stop whe
i
hits 5:30PM each day. How would I make this possible
This is what i have so far
Sub StartTiming(
Call StartCloc
With ThisWorkbook.Sheets("Sheet1"
'Clear total elapsed tim
.Range("j3".ClearContent
'Format the cells with time format
.Range("j1:j3".NumberFormat = "hh:mm:ss"
'Save the start time in cell J
.Range("j1".Value = Range("j2".Valu
End Wit
End Su
Sub StartClock(
With ThisWorkbook.Sheets("Sheet1"
.Range("j1" = Now(
End Wit
NextTick = Now + TimeValue("00:00:01"
Application.OnTime NextTick, "StartClock"
End Su
Sub StopClock(
'Stop OnTime event
'Returns error if already stopped and hense the on error handling
On Error Resume Nex
Application.OnTime
EarliestTime:=NextTick,
Procedure:="StartClock",
Schedule:=Fals
If Err.Number > 0 Then Exit Su
On Error GoTo
With ThisWorkbook.Sheets("Sheet1"
.Range("j3".Value
= .Range("j2".Value - .Range("j1".Valu
End Wit
End Sub
I have a clock macro in an excel worksheet that I would like it to stop whe
i
hits 5:30PM each day. How would I make this possible
This is what i have so far
Sub StartTiming(
Call StartCloc
With ThisWorkbook.Sheets("Sheet1"
'Clear total elapsed tim
.Range("j3".ClearContent
'Format the cells with time format
.Range("j1:j3".NumberFormat = "hh:mm:ss"
'Save the start time in cell J
.Range("j1".Value = Range("j2".Valu
End Wit
End Su
Sub StartClock(
With ThisWorkbook.Sheets("Sheet1"
.Range("j1" = Now(
End Wit
NextTick = Now + TimeValue("00:00:01"
Application.OnTime NextTick, "StartClock"
End Su
Sub StopClock(
'Stop OnTime event
'Returns error if already stopped and hense the on error handling
On Error Resume Nex
Application.OnTime
EarliestTime:=NextTick,
Procedure:="StartClock",
Schedule:=Fals
If Err.Number > 0 Then Exit Su
On Error GoTo
With ThisWorkbook.Sheets("Sheet1"
.Range("j3".Value
= .Range("j2".Value - .Range("j1".Valu
End Wit
End Sub