我想进行倒计时,因此我设置了一个时区格式的单元格E1
,并将0:02:55
作为开始时间。之后我尝试使用此代码单击按钮后进行coutdown,但出现错误,它不可运行。
Sub Timer()
Dim gCount As Date
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "ResetTime"
End Sub
Sub ResetTime()
Dim xRng As Range
Set xRng = Application.ActiveSheet.Range("E1")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub