Dim NextTick As Date, t As Date
Sub StartClock()
If Range("IV1").Value = True Or Range("IV1").Value = "" Then
t = Time
Range("IV1").Value = False
End If
Call TickTock
End Sub
Private Sub TickTock()
Range("A1").Value = Format(Time - t, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"
End Sub
Sub StopClock()
On Error Resume Next
Application.OnTime earliesttime:=NextTick, procedure:="TickTock", schedule:=False
On Error GoTo 0
End Sub
Sub Reset()
Call StopClock
Range("A1").Value = 0
Range("IV1").Value = True
End Sub
Dim NextTick As Date, t As Date
Sub StartClock()
If Range("IV1").Value = True Or Range("IV1").Value = "" Then
t = Time
Else
t = Time - Range("IV2").Value
End If
Call TickTock
End Sub
Private Sub TickTock()
Range("A1").Value = Format(Time - t, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"
End Sub
Sub StopClock()
Range("IV1").Value = False
Range("IV2").Value = Range("A1").Value
On Error Resume Next
Application.OnTime earliesttime:=NextTick, procedure:="TickTock", schedule:=False
On Error GoTo 0
End Sub
Sub Reset()
Call StopClock
Range("A1").Value = 0
Range("IV1").Value = True
Range("IV2").ClearContents
End Sub