The following is a simple example of a timer with the Start Timer and Stop
Timer subs.
Custom format the cell to display the time so that it includes the date and
the time including seconds. Example for regional date displayed in D/M/Y
format.
d mmm yyyy h:mm:ss
'RunWhen must be declared at top of
'a standard Module before any subs
Public RunWhen As Date
Sub StartTimer()
Dim TimerIntervals
TimerIntervals = 1 'In seconds
RunWhen = Now + _
TimeSerial(0, 0, TimerIntervals)
ActiveSheet.Range("A1") = Now
Application.OnTime _
EarliestTime:=RunWhen, _
Procedure:="StartTimer", _
Schedule:=True
End Sub
Sub StopTimer()
'On Error required in case timer already stopped
'RunWhen must be same value that started timer
On Error Resume Next
Application.OnTime _
EarliestTime:=RunWhen, _
Procedure:="StartTimer", _
Schedule:=False
End Sub