I have setup a timer in excel using the below and its fine everything works.
my only issue is the screen glitches ever so slightly every time the macro runs(every second) not a big issue viisually but sometimes if im typing or trying to edit a formula or macro it can cause it to cancel what im doing.
is there a better way to have a timer running?
my only issue is the screen glitches ever so slightly every time the macro runs(every second) not a big issue viisually but sometimes if im typing or trying to edit a formula or macro it can cause it to cancel what im doing.
is there a better way to have a timer running?
VBA Code:
Option Explicit
Dim NextTick As Date, t As Date, PreviousTimerValue As Date
Sub setKey()
Application.OnKey "+^:", "EnterTime"
End Sub
Sub resetKey()
Application.OnKey "+^:"
End Sub
Sub EnterTime()
With ActiveCell
.Value = Time()
.NumberFormat = "hh:mm:ss"
End With
End Sub
Private Sub ExcelStopWatch()
ElectronicForm.Range("StopWatch").Value = Format(Time - t + PreviousTimerValue, "hh:mm:ss")
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "ExcelStopWatch"
End Sub