Add digital clock in ms excel - live example using vba code

Опубликовано: 10 Май 2026
на канале: BPO Interview Tutorials
70
4

vba code:

​Dim NextTick As Date

Sub StartClock()
' Specify the sheet name and cell where the clock should appear
' Change "Sheet1" and "A1" to match your setup
Sheets("Sheet1").Range("A1").Value = Now

' Set the timer to run this macro again in 1 second
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "StartClock"
End Sub

Sub StopClock()
' This macro stops the clock timer
On Error Resume Next
Application.OnTime NextTick, "StartClock", , False
End Sub