=TODAY()
在单元键数裤格C3中,有两种方案:
一是从开始就进行倒计时,二是距结束日期为若干稿简天进行倒计时(设25天)。
当从开始就进行倒计时毕激:C3:
=D3-B3
当距结束日期为若干天进行倒计时:C3:
=IF(D3-B3<26,D3-B3,””)。
Dim Hours As IntegerDim Minutes As Integer
Dim Seconds As Integer
Dim Time As Date
Private Sub Command2_Click()
Timer1.Enabled = True
End Sub
Private Sub Command1_Click()
Number = InputBox("输入倒计时时间,以秒为单位", "输入框", "100"拆旦)
Hours = Number / 3600
Minutes = (Number - Hours * 3600) / 60
Seconds = (Number - Hours * 3600 - Minutes * 60)
Time = TimeSerial(Hours, Minutes, Seconds)
Label1.Caption = Format$(Time, "hh") &":" &Format$(Time, "nn" _
)&":" &Format$(Time, "ss")
End Sub
Private Sub Form_Load()
Form1.Top = (Screen.Height - Form1.Height) / 2
Form1.Left = (Screen.Width - Form1.Width) / 2
Timer1.Interval = 1000
Hours = 0
Minutes = 0
Seconds = 0
Time = 0
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
If (Format$(Time, "hh") &":" &Format$(Time, "nn") &"旅亩扰:" &Format$(Time, "ss")) <>"00:00:00" Then 'Counter to continue lo _op until 0
Time = DateAdd("s", -1, Time)
Label1.Visible = False
Label1.Caption = Format$(Time, "hh") &":" &Format$(Time, "nn" _
) &":" &Format$(Time, "ss")
Label1.Visible = True
Timer1.Enabled = True
Else
Timer1.Enabled = False
Beep
Beep
End If
End Sub
'建Command1,Command2,timer1,label1. 试试吧,响铃从耳机耐启输出,
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)