How to create a countdown timer in Excel
How to create a countdown timer in Excel: Creating a countdown timer in Excel is a topic that many people are interested in. You will need a countdown timer when you need to “run the schedule” to complete a task or project. Follow the article below to learn how to create a countdown timer in Excel.
Step 1
To create a countdown timer, first open the Excel file you want to create the timer in. Then right-click on the cell where you want to create the countdown timer. The scroll bar appears and you select the Format Cells option.
Step 2
At this point, the Format Cells dialog box appears. Select the Number tab. Then in the Category section, select Time. Next, in the Locale section, select Vietnamese. Then select the format of the hour you want to create in the Type section. Finally, press OK to complete.
Step 3
Back to the Excel worksheet, enter the countdown time you want as well as edit the format of the cell to make it stand out and create a caption for the cell.
Step 4
Now, select the Developer tab on the toolbar. Then select the Visual Basic option. Or you can use the shortcut Alt + F11 to open the VBA window.
Step 5
At this point, the Microsoft Visual Basic for Applications window appears. Select the Insert tab on the toolbar. The scroll bar appears and you select the Module option.
Step 6
At this point, the Module dialog box appears. Copy the code below into it. Note that D3 will be replaced by the position of the cell where you create the timer.
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("D3")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub
Step 7
After copying the code, press the Run icon on the toolbar to run the code.
That’s it! The time in cell D3 will automatically countdown. You can change the countdown time as desired, and the timer will not stop until the time is up.
After the countdown is complete, a message “Countdown complete” will appear as shown in the image below.
So, the above article has shown you how to create a countdown timer in Excel. Hopefully, the article will be useful to you in your work. Good luck!