You are on page 1of 10

HOW TO MAKE DIGITAL CLOCK IN EXCEL

Download Practice Workbook


Download this practice workbook to exercise while you are reading this article. It contains all the datasets in
different spreadsheets for a clear understanding. Try it yourself while you go through the step-by-step
process.

2 Suitable ways to Create Digital Clock in Excel


Creating a digital clock in with automatic refresh can be easy if we carefully follow some easy procedures.
We will align the clock time with our PC time and thus it will match the hours, minutes & seconds every time
we open the workbook. To demonstrate, we take a dataset representing the function and cases needed to
create a digital clock.

PR-I-04 (Version 1)
1. Build Digital Clock Through Excel VBA and TEXT Function
In our first method, we will thoroughly use the TEXT function and Excel VBA to build a digital clock with an
automatic refresh. We will insert a VBA code that will
generate the current time in our dataset and the text function will convert the time into text formats and
display it in our clock. Follow the below steps carefully to do so.
Steps:
 First, go to Insert > Illustrations > Shapes tabs.
 See the below picture to understand better.

PR-I-04 (Version 1)
 Eventually, the Shapes menu options box will pop up.
 Here, select the Rounded Rectangular option.

PR-I-04 (Version 1)
 As a result, a rounded rectangular shape appears in our workbook.

PR-I-04 (Version 1)
 Afterward, go to the Developer tab and click Visual Basic.

 Consequently, the Visual Basic window opens up.


 Now, go to the Insert tab and click the Module option to create a module box.

PR-I-04 (Version 1)
 Later, in the module box, write the following VBA code.
Sub Digi_Clock()
Range("B5") = Not Range("B5")
Do While Range("B5") = True
DoEvents
Range("B6") = Now()
Loop
End Sub
Copy

 Then, press the green Run button.

PR-I-04 (Version 1)
 Next, in cell B4, type TRUE and hit the Enter or Tab keys.

PR-I-04 (Version 1)
 Further, right-click on the rounded rectangle.

 Thus, a context menu pops up.

 There, select the Assign Macro option to include the code in the rectangle.

 Therefore, we insert VBA into the rectangle shape.


 This will later display the time.

PR-I-04 (Version 1)
 This converts the time in cell B6 and returns a time format in hh:mm:ss format.
 Lastly, press the Enter key again.
 In the end, go to the Home tab and then the Font group.
 There, customize the font color, size & style.

 Hence, the time appears in digital format.

PR-I-04 (Version 1)
PR-I-04 (Version 1)

You might also like