excel怎样做催款时间倒计时
㈠ 如何用EXCEL做倒计时
1.
A1 输入 2008-8-8 8:8:8
B1 输入 =NOW() 这是现在的时间实时变化的 可以不要这列
C1 输入 =B1-A1
D1 输入:
=INT(C1)&"天"&TEXT(C1-INT(C1),"h时m分s秒")
D1 便是倒计时
这是详细的分解了计算过程
你可以直接在
A1 输入 2008-8-8 8:8:8
B1 输入=INT(NOW()-A1)&"天"&TEXT(NOW()-A1-INT(NOW()-A1),"h时m分s秒")
就ok了
这样你每次打开文档都会更新时间
应为now()就是取现在的时间
注意:a1你要输入日期数据而不是你的那种 200,150 的
你说清单位的话可以转换
整列的话你只要向下托动单元格就可以了
2.
比方说你要设定一个到10:30的倒计时,用这个公式:
=TIMEVALUE("10:30:00")-TIMEVALUE(HOUR(NOW())&":"&MINUTE(NOW())&":"&SECOND(NOW()))
当然你还要把单元格格式设置为时间格式。
3.VBA做的
窗体上放一个label,一个HScrollbox,三个Commandbutton,一个timer
双击窗体,删掉别的代码,粘贴下面代码:
Dim Minute, Second As Long
Private Sub Command1_Click()
Minute = InputBox("输入分钟数", "倒计时时间")
Second = 60 * Minute
Label1.Caption = "倒计时时间为" & Minute & "分钟"
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Label1.Caption = "已结束倒计时"
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Timer1_Timer()
If Second < 0 Then
Timer1.Enabled = False
Else
Label1.Caption = IIf(Second \ 3600 = 0, "00", IIf(Second \ 3600 < 10, "0" & Second \ 3600, Second \ 3600)) & ":" & IIf(Second \ 60 Mod 60 = 0, "00", IIf(Second \ 60 Mod 60 < 10, "0" & Second \ 60 Mod 60, Second \ 60 Mod 60)) & ":" & IIf(Second Mod 60 Mod 60 = 0, "00", IIf(Second Mod 60 Mod 60 < 10, "0" & Second Mod 60 Mod 60, Second Mod 60 Mod 60))
HScroll1.Value = (60 * Minute - Second) / (60 * Minute) * HScroll1.Max
Second = Second - 1
End If
End Sub