Try this way.
In Standard Module.
Sub CountDwn()
Calculate
Application.OnTime Now + TimeValue("00:00:01"), "CntDownTimer"
End Sub
Sub CntDownTimer()
Dim startdate As Date, enddate As Date
Dim days As Long, hours As Long, minutes As Long, seconds As Long
startdate = Now()
enddate = "31/12/2019 20:00:00"
days = Int(DateValue(enddate) - DateValue(startdate))
hours = Hour(TimeValue(enddate) - TimeValue(startdate))
minutes = Minute(TimeValue(enddate) - TimeValue(startdate))
seconds = Second(TimeValue(enddate) - TimeValue(startdate))
Range("D8") = days
Range("F8") = hours
Range("H8") = minutes
Range("J8") = seconds
CountDwn
End Sub
Sub StopCntDwn()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:01"), "CntDownTimer", , False
End Sub
In ThisWorkbook.
Private Sub Workbook_Open()
CountDwn
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
StopCntDwn
End Sub
Bookmarks