我相信你不是定时航天飞机发射或任何关键的。但是,如果您想确保倒数时间不超过30秒,则可以使用定时器功能。这是一个例子。
Sub NewTimer()
Dim Start As Single
Dim Cell As Range
Dim CountDown As Date
'Timer is the number of seconds since midnight.
'Store timer at this point in a variable
Start = Timer
'Store A1 in a variable to make it easier to refer
'to it later. Also, if the cell changes, you only
'have to change it in one place
Set Cell = Sheet1.Range("A1")
'This is the starting value. Timeserial is a good
'way to get a time
CountDown = TimeSerial(0, 0, 30)
'Set our cell to the starting value
Cell.Value = CountDown
'Keep executing this loop until A1 hits zero or
'even falls slightly below zero
Do While Cell.Value > 0
'Update the cell. Timer - Start is the number of seconds
'that have elapsed since we set Start.
Cell.Value = CountDown - TimeSerial(0, 0, Timer - Start)
'DoEvents release control ever so briefly to Windows. This
'allows Windows to do stuff like update the screen. When you
'have loops like this, your code appears frozen because it's
'not letting Windows do anything (unless you have this line)
DoEvents
Loop
End Sub
什么是** ** A1的初始值Δα ** A1 **和** D2 **如何相关? –
OMG im such a twit .... –
A1 = 00:00:30,D2应该是A1 .....我也改变了等待到 Application.Wait Now + TimeValue(“0:00:01”) –