excel vba timer add code example
Example: excel vba countdown timer
Select AllPublic interval As Date
Sub timer()
interval = Now + TimeValue("00:00:01")
If Range("A1").Value = 0 Then Exit Sub
Range("A1") = Range("A1") - TimeValue("00:00:01")
Application.OnTime interval, "timer"
End Sub
Sub stop_timer()
Application.OnTime EarliestTime:=interval, Procedure:="timer", Schedule:=False
End Sub