EXCEL TIMER COUNTDOWN ON SINGLE CELL

1,045 Views

SHARE

EXcel count down timer is very important applications design like an alarm and triggers another macro with real-time visualization. Today I’m going to share with you my testing code its 100% working. copy the code and use it for your project.

 

How to create macro and module

  • open your excel
  • Rename your excel workbook
  • save
  • go to view tab then click on view tab go to macro option
  • Then right click on macro to view macro remame or creame new macro hit enter to go to code page
  • copy this given below code on your code to use on your visual timer on cell
Option Explicit
Option Base 1
Dim AlarmTime As Date, AlarmTime2 As Date
 
Sub Count_Down_Timer()
worksheet(sheet1).Range("A1").ClearContents
'Range("B1").ClearContents
Dim Min As Long
Dim Sec As Long
Min = 0
Sec = 40
worksheet(sheet1).Range("A1").Value = Min & ":" & Sec
worksheet(sheet1).Range("A1").Value = 0
worksheet(sheet1).Range("B1").Value = 40
Call TrapTime
Call TrapTime2
End Sub
 
Private Sub ShowTimeLeft()
Dim Min As Long
Dim Sec As Long
Min = Minute(AlarmTime - Now)
Sec = Second(AlarmTime - Now)
ActiveSheet.Range("A1").Value = Min & ":" & Sec
worksheet(sheet1).Range("A1").value = Minute(AlarmTime - Now)
worksheet(sheet1).Range("B1").value = Second(AlarmTime - Now)
Call TrapTime2
End Sub
 
Private Sub TrapTime()
AlarmTime = CDate(Date) + TimeValue(Now()) + TimeValue("00:00:40")
Application.OnTime earliesttime:=AlarmTime, procedure:="StopTimer"
End Sub
 
Private Sub TrapTime2()
AlarmTime2 = CDate(Date) + TimeValue(Now()) + TimeValue("00:00:01")
Application.OnTime earliesttime:=AlarmTime2, procedure:="ShowTimeLeft"
End Sub
 Private Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=AlarmTime2, procedure:="showtimeleft", schedule:=False
If worksheet(sheet1).Range("A1").Value = worksheet(sheet1).Range("b2").Value Then
Call mynewmacro
End If
On Error GoTo 0
End Sub



13370cookie-checkEXCEL TIMER COUNTDOWN ON SINGLE CELL

Author: yawot

Leave a Reply

Your email address will not be published. Required fields are marked *