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