倒计时(Excel代码集团)
'之一 Sub Sample() Range( "b2" ) = "=now()" If Range( "b2" ) >= Range( "c2" ) Then MsgBox "时间到" Exit Sub End If Call StartTime End Sub Sub StartTime() Application.OnTime Now + TimeSerial(0, 0, 1), "Sample" End Sub
'之二 Sub Sample() Do While range( "d2" ) > Now '活动时间未过期即不断循环 Application.Wait Now + TimeSerial(0, 0, -1) '控制时间 Application.Calculate '计算工作表 Loop MsgBox "时间到!" End Sub