Skip to content

Instantly share code, notes, and snippets.

@ndthanh
Last active July 22, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndthanh/ab52225999e2f70c0ca73ec0772f2d9f to your computer and use it in GitHub Desktop.
Save ndthanh/ab52225999e2f70c0ca73ec0772f2d9f to your computer and use it in GitHub Desktop.
Dim gCount As Date
'Updateby20140925
Sub Timer()
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "ResetTime"
End Sub
Sub ResetTime()
Dim xRng As Range
Set xRng = Application.ActiveSheet.Range("E1")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment