发布网友 发布时间:2022-04-23 07:37
共3个回答
热心网友 时间:2022-06-17 19:28
Dim IsRun As Boolean
Sub djs()
Dim sTime As Date, djs As Long, shi As Long, fen As Long, miao As Long
sTime = Now
shi = Sheet1.Range("a1"): fen = Sheet1.Range("b1"): miao = Sheet1.Range("c1") '设置倒计时值
Do
djs = (shi * 60 + fen) * 60 + miao - DateDiff("s", sTime, Now)
Sheet1.Range("a2") = Int(djs / 3600) & "时"
Sheet1.Range("b2") = Int((djs Mod 3600) / 60) & "分"
Sheet1.Range("c2") = djs Mod 60 & "秒"
DoEvents
If Not IsRun Then MsgBox "倒计时中断": Exit Sub
Loop While djs > 0
MsgBox "倒计时完成"
End Sub
Private Sub CommandButton1_Click()
If IsRun = False Then IsRun = True: djs '开始按钮
End Sub
Private Sub CommandButton2_Click()
IsRun = False '中断按钮
End Sub
第一行输入倒计时时间,表格上放置两个按钮可控制开始和终止倒计时
热心网友 时间:2022-06-17 19:28
a1=46:45:30
Sub time111()
Application.OnTime Now + TimeValue([a1]), "uuu"
End Sub
Sub uuu()
MsgBox " 00:00:15 已过时间了"
End Sub
热心网友 时间:2022-06-17 19:29
通常只有输入一个确定的时间点,然后开始倒计时
http://jingyan.baidu.com/article/ab0b5630cf94f2c15bfa7d66.html