writes the time to cell A1 and also programs another event five seconds later.
Dim NextTick As Date
Sub UpdateClock()
ThisWorkbook.Sheets(1).Range("A1") = Time
NextTick = Now + TimeValue("00:00:05")
Application.OnTime NextTick, "UpdateClock"
End Sub
Sub StopClock()
On Error Resume Next
Application.OnTime NextTick, "UpdateClock", , False
End Sub
Related examples in the same category