I have an issue with a running clock in one of my sheets.
The clock runs in hh:mm format, because I don't need/want the seconds to be displayed.
The clock is initiated upon activation of the sheet.
Code as below.
Now he thing is, when I activate the sheet at say 09:39:30, then the cell shows 09:39. Which is correct.
However, the cell only changes to 09:40 one minute after activation, which is at 09:40:30. Which is 30 seconds too late.
How to solve this ?
The clock runs in hh:mm format, because I don't need/want the seconds to be displayed.
The clock is initiated upon activation of the sheet.
Code as below.
Now he thing is, when I activate the sheet at say 09:39:30, then the cell shows 09:39. Which is correct.
However, the cell only changes to 09:40 one minute after activation, which is at 09:40:30. Which is 30 seconds too late.
How to solve this ?
VBA Code:
Private Sub Worksheet_Activate()
Application.OnTime Now + TimeSerial(0, 1, 0), "UpdateTimer1"
End Sub
VBA Code:
Public Sub UpdateTimer1()
ActiveSheet.Cells(1, 2).Value = Format$(Now, "mm/dd/yyyy")
ActiveSheet.Cells(2, 2).Value = Format$(Now, "hh:mm")
Application.OnTime Now + TimeSerial(0, 1, 0), "UpdateTimer1"
End Sub