4,375 questions
How to create a countdown timer in Office Scripts.
Terzinski, Tyde
5
Reputation points
I am able to create a countdown timer in Excel with VBA, but we are required to use Excel web with scripts. Does an equivalent for VBA's "Application.OnTime" exist in office scripts?
End goal is to setup two buttons:
- start timer from 0:00 and count up by 1 second each second
- stop timer
below is the VBA code I've used for countdown timers but I cannot convert it to scripts if Application.OnTime does not exist in office scripts.
Thanks!
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
Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
3,891 questions
Sign in to answer