Paste into a routine module:
Option Explicit
Dim NextTick As Date, t As Date
Sub StartStopWatch() '______________________________________________________________________________'same as 'Box' in your code
MsgBox "hello world"
t = Time
Call StartTimer
End Sub
Sub StartTimer()' ________________________________________________________________________________ 'same as 'test' in your code
NextTick = Time + TimeValue("00:00:30") '_______________________________________________________'updates time display A1 every 30 seconds
Range("A1").Value = Format(NextTick - t - TimeValue("00:00:01"), "hh:mm:ss") '__________________'keeps track of time passing each second
Application.OnTime NextTick, "StartTimer" '_____________________________________________________'re-iterates itself to count every second
End Sub
Sub StopTimer() '___________________________________________________________________________________'same as 'StopMacro' in your code
On Error Resume Next
Application.OnTime EarliestTime:=NextTick, Procedure:="StartTimer", Schedule:=False
End Sub
Two command buttons on Sheet1 : one attached to macro StartStopWatch ... the other attached to macro StopTimer