Pexels Start this process by clicking on the view tab followed by clicking on the view macros button. Type in a macro name or use Runclock with no spaces. Click on the plus button. In Windows press the create button after a name is created. Next, type in or paste the code shown below. Be sure to change the range to the cell where you would like the clock to appear in. Sub Runclock() Range(“B1”).Value = Now Application.OnTime Now + TimeValue(“00:00:01”), “runclock” End Sub
Attach the Macro to a Button
Click on the insert tab followed by clicking the shapes button. Choose a shape to use as a button. Right-click on the shape and click the assign macro option. Select the Runclock macro and choose OK. Deselect the button by clicking in any cell.
Run the Clock
Click on the button to get the clock started. You may need to adjust the width of the column used for the time/date to be visible.
Format the Clock
Select the cell with the clock and select the format drop-down in the home tab to change the format. Choose a standard format in the time or date section. I used a custom format to show a specific time and date format in this example and is found in bold below if you would like to copy and use it as your custom format. mmm-yy hh:mm:ss AM/PM
After choosing the proper formatting, you will have a running clock in your Excel file. If you are using Excel for Windows you may experience a screen refresh (screen flickering) which is normal. This happens as a result of the macro running every second. It can be annoying. Conversely, if you are using Excel for macOS, you may not experience the screen refresh. See the results from using the example formatting in custom formats. You may use the clock anywhere in an Excel workbook. To duplicate the clock, simply have another cell equal that cell and copy the formatting to the new cell.
Displaying Other Time Zone
You can display other time zones by equaling the cell with the time stamp and either adding or subtracting fractions of 24 hrs. See the example below where I add and subtract an hour from the current date and time. This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional. © 2022 Joshua Crowder