logo
search
VBA & Macro Problems

How to Create Cell-Specific Timestamps and User Verification in Excel

Maira MehtabMaira Mehtab Sep 27, 2026 870 views

Question details

The user needs to set up a system to verify users, record sign-offs, and generate automatic timestamps for specific cells using macro code.

Product
Microsoft Excel
Device & OS
not provided
Scenario
Tracking user edits and recording sign-offs on a shared worksheet.
Observed behavior
Need a macro-enabled solution to automatically log the current time and user identity when specific cells are modified, as standard formulas cannot create static timestamps.
Before you start

Ensure you are using the desktop version of Excel, as VBA macros are not fully supported in the web version. You will also need to enable the Developer tab to access the VBA editor.

Solution 1Recommended

Use VBA Worksheet Event Code to Generate Timestamps

Implement a VBA script using the Worksheet_Change event to automatically record the current time and username when a specific cell is edited.

Because standard Excel formulas like =NOW() will recalculate every time the sheet changes, VBA is required to create a static, permanent timestamp.

The script will capture the user's system login name and insert the current date and time directly into adjacent cells whenever a target cell is modified.

1
Open the VBA Editor

Press ALT + F11 in Excel to open the Visual Basic for Applications (VBA) editor window.

2
Access the Worksheet Module

In the Project Explorer panel on the left, double-click the specific sheet where you want the timestamps to appear (e.g., Sheet1).

3
Set Up the Worksheet Change Event

Select 'Worksheet' from the left dropdown menu at the top of the code window, and choose 'Change' from the right dropdown menu.

4
Insert the Timestamp Code

Write your custom VBA code to check if the modified cell (Target) is within your desired range. Use Target.Offset(0, 1).Value = Now to insert the timestamp and Environ("USERNAME") to fetch the user verification.

5
Save as Macro-Enabled Workbook

Go to File > Save As, and choose 'Excel Macro-Enabled Workbook (*.xlsm)' from the format dropdown to ensure your VBA code is preserved and executable.

Enable Macros: Users opening this file must click 'Enable Content' in the security warning bar for the VBA timestamp script to function properly.

Create VBA Timestamps Seamlessly with WPS Office

WPS Office provides robust support for VBA macros, allowing you to implement user verification and automated timestamps effortlessly. Enjoy a highly compatible and efficient spreadsheet experience.

  1. 1. Open WPS Spreadsheets: Launch WPS Office and open your spreadsheet document.
  2. 2. Access the VBA Editor: Navigate to the Developer tab on the top ribbon and click on 'VBA Editor'.
  3. 3. Insert Your Code: Double-click your target worksheet in the Project window and input your Worksheet_Change event code for the timestamp.
  4. 4. Save the Document: Save the document as a Macro-Enabled Workbook (.xlsm) to retain your timestamp functionality.
Fully compatible with Microsoft Excel .xlsm macro-enabled formats.Built-in VBA editor for creating and running complex macros.Lightweight installation with a familiar, easy-to-navigate interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel timestamp change every time I edit the sheet?

If you use standard =NOW() or =TODAY() formulas, Excel recalculates them dynamically. To create a static timestamp that doesn't change, you must use a VBA macro or manually insert the time using the keyboard shortcut (Ctrl + Shift + ;).

Can I track who edited a cell without using VBA?

Without VBA, you can use Excel's 'Track Changes' feature (in older versions) or 'Show Changes' in Microsoft 365. However, to permanently stamp the username in a specific adjacent cell automatically, VBA is required.

Why isn't my VBA timestamp macro working?

Ensure that you have saved the file as a Macro-Enabled Workbook (.xlsm) and that macros are allowed in your Trust Center settings. Additionally, verify that your code is placed directly in the specific Worksheet module rather than a standard module.