Enter the Current Time with Seconds in Excel Using a VBA Macro
Question details
The user needs a reliable way to enter the current time, including seconds, as a fixed value in an Excel cell.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to quickly timestamp the active cell with the current time and display it in hh:mm:ss format.
- Observed behavior
- Excel does not provide a standard built-in keyboard shortcut that reliably inserts and displays the current time with seconds.
To use the macro method, open the workbook in a desktop version of Excel that supports VBA and save the file as an Excel Macro-Enabled Workbook (*.xlsm). Make sure macros are enabled when you reopen the workbook.
Create a VBA macro to insert the current time with seconds
Use this method when you need a permanent time value with seconds in the selected cell and want to trigger it from a shortcut or toolbar button.
The macro writes the current system time to the active cell and applies a time format that always shows hours, minutes, and seconds. Unlike a NOW-based formula, the inserted value does not recalculate later.
In Excel, press Alt+F11 to open the Visual Basic Editor. In the Project pane, select your workbook, then choose Insert > Module.
Paste this code into the new module: Sub EnterCurrentTimeWithSeconds() ActiveCell.Value = Time ActiveCell.NumberFormat = "hh:mm:ss" End Sub
Return to the worksheet, select the target cell, then press Alt+F8. Select EnterCurrentTimeWithSeconds and click Run.
Press Alt+F8, select EnterCurrentTimeWithSeconds, click Options, enter a shortcut key, and click OK. Select a cell and use that shortcut whenever you need a timestamp.
Choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm) so the VBA code and shortcut remain available.

Use the built-in time shortcut and change the cell format
Use this option when you do not need a custom macro and the inserted time value already contains seconds but they are hidden by the current format.
Use a NOW formula for a live, recalculating time display
Use this method only when the cell should continually reflect the current time instead of storing the time when it was entered.
Insert Fixed Timestamps with Seconds in WPS Spreadsheets
WPS Spreadsheets provides a familiar worksheet environment for entering and formatting timestamps. In versions with VBA macro support, you can add a macro that writes the current time to the selected cell, formats it as hh:mm:ss, and runs from the Macro dialog or an assigned shortcut.
- 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, open the workbook, and select the worksheet where you want to insert time values.
- 2. Access the VBA editor: Open the Developer tab and select Visual Basic, then choose Insert > Module in the VBA editor.
- 3. Add the timestamp code: Paste a macro that assigns Time to ActiveCell.Value and sets ActiveCell.NumberFormat to "hh:mm:ss".
- 4. Run or assign the macro: Return to WPS Spreadsheets, select a target cell, and use Developer > Macros to run the macro or assign it a shortcut where available.
- 5. Save as a macro-enabled file: Use Save As and select the Excel Macro-Enabled Workbook (*.xlsm) format to retain the macro.

Frequently Asked Questions
How do I insert the current time with seconds as a fixed value in Excel?
Use a VBA macro that sets ActiveCell.Value = Time and ActiveCell.NumberFormat = "hh:mm:ss". Running the macro inserts a non-recalculating time value in the selected cell.
Why does Ctrl+Shift+; not show seconds in my Excel timestamp?
The cell may be using a time format that hides seconds. Select the cell, press Ctrl+1, choose Custom, and apply the format hh:mm:ss.
Can I use NOW() to create a permanent timestamp?
No. NOW() recalculates when Excel recalculates. Use a VBA macro or copy and paste the formula result as values if the timestamp must remain unchanged.
How can I insert both the current date and time with seconds?
In the macro, replace Time with Now, then apply a format such as yyyy-mm-dd hh:mm:ss. This writes the current date and time as a fixed value.
Why must I save the workbook as an .xlsm file?
An .xlsm file preserves VBA code. If you save a macro workbook as .xlsx, Excel removes the macro from the file.




