On its own, Excel doesn't have a function to include a countdown timer. However, with a programming language called Visual Basic for Applications, it's possible to write a simple macro to perform the countdown function. This article shows how to create a macro that enables a timer to count down up to 12 hours, suitable for time management within a worksheet.
Format the Timer Cell
Video of the Day
Step 1
In a new, open worksheet, navigate to cell A1. This will be the location of the example timer.
Video of the Day
Step 2
![Accessing Cell Format](https://img.techwallacdn.com/375/ppds/574e1aa5-4422-4456-b3af-37199d41b4d6.png)
Right-click cell A1 and select Format Cells.
Step 3
![Selecting Hours/minutes/seconds Format.](https://img.techwallacdn.com/375/ppds/83de9f39-bad8-4d69-aba2-6a17d697a81c.png)
Select Time from the Category box and choose one of the hours:minutes:seconds formats. Click OK to set the cell format.
Create the Macro
Step 1
![Opening a VBA Module.](https://img.techwallacdn.com/375/ppds/7cce15d1-7325-4620-83ee-b55af06e5cd1.png)
Access the Visual Basic editing window by pressing ALT-F11. Click Insert from the menu bar and click Module.
Step 2
![Entering VBA code](https://img.techwallacdn.com/375/ppds/2bf11b8f-0b3b-4e9f-a020-0bc198e075c8.png)
Enter the following text in the Module1 window:
Dim gCount As Date
Sub Timer()
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "EndMessage"
End Sub
Sub EndMessage()
Dim xRng As Range
Set xRng = Application.ActiveSheet.Range("A1")
xRng.Value = xRng.Value - TimeSerial(0, 0, 1)
If xRng.Value <= 0 Then
MsgBox "Countdown complete."
Exit Sub
End If
Call Timer
End Sub
You can copy and paste the code text above, or you can type it, line-by-line, into the Module1 window. The VBA editor applies formatting as needed.
Step 3
![Saving as a Macro Enabled Workbook](https://img.techwallacdn.com/375/ppds/4eb4e78f-f36c-46be-b870-368f1153fa0a.png)
Minimize the VBA window by clicking the - symbol in the upper right corner. Click File on the ribbon and Save As. Select a location to save your file. In the Save As window, give your workbook a name and select Excel Macro-Enabled Workbook (*.xlsm) from the Save as type drop-down list. Click Save and return to the workbook.
Using the Timer
Step 1
Click on cell A1 and enter 0:3:0, then press Enter. This sets the time for 0 hours, 3 minutes and 0 seconds.
Step 2
Click the View tab on the ribbon and click Macros. Select Timer from the Macro list and click Run. Your timer cell will begin counting down to zero, when a Countdown Complete dialog opens. Click OK to return to your work.