How to Verify If an Excel Macro Ran Successfully (and Track Users)
Question details
The user needs to confirm that an Excel macro executed properly and wants to track exactly which users or students ran it within a shared workbook.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A teacher or document owner distributes a macro-enabled workbook and needs to audit usage to ensure recipients are successfully running the required automated tasks.
- Observed behavior
- Excel successfully runs the macro when enabled, but it does not natively provide a built-in log of user execution history, making compliance tracking difficult.
Ensure your workbook is saved in a macro-enabled format (such as .xlsm) and that macros are enabled in your spreadsheet security settings before testing your VBA code.
Verify Macro Output Manually
The simplest way to confirm a macro ran successfully is to check if its intended actions or calculations were completed.
If a macro performs a visible action, such as formatting cells, generating a report, or calculating data, you can quickly verify its execution by reviewing the final state of the worksheet.
Before running the macro, note exactly what changes the code is supposed to make in the workbook.
Go to the Developer tab, click on 'Macros', select your target macro, and click 'Run'.
Check the specific cells, sheets, or files that the macro targets to ensure the expected updates were applied.
Add VBA Logging to Track User Execution
To actively track whether specific users, such as students, ran a macro, you can add a lightweight logging script directly into your VBA code.
Create and Track Macros Seamlessly with WPS Spreadsheet
WPS Spreadsheet offers robust support for VBA macros, allowing you to write, edit, and track VBA codes just like in Microsoft Excel, making it perfect for managing automated tasks and student assignments.
- 1. Download and open WPS Office: Install WPS Office and launch the WPS Spreadsheet application.
- 2. Open your macro-enabled file: Open the .xlsm workbook that contains the macros you wish to run or track.
- 3. Access the Developer tools: Navigate to the 'Developer' tab on the ribbon and click 'Macros' to execute code or 'Visual Basic' to edit the script.
- 4. Implement VBA logging: Easily add tracking scripts to your modules to monitor user activity, then save your secure workbook.

Frequently Asked Questions
Why doesn't Excel show who ran a macro by default?
For privacy, security, and file performance reasons, Excel does not maintain a built-in audit trail of macro executions. Tracking user actions requires custom VBA code to log environmental variables like the username and system time.
Can I track macro usage if the user disables macros?
No. If a user chooses to disable macros upon opening the workbook, the VBA tracking code cannot execute. To ensure compliance, developers often use a 'Macro Forcing' technique, which hides all main content sheets until the user explicitly enables macros.
How do I find the username of the person running the macro?
In VBA, you can use the function 'Environ("USERNAME")' to retrieve the Windows login profile name of the person currently executing the code. This is extremely useful for tracking which student or employee is actively working in the file.
Does WPS Office support running and editing Excel VBA macros?
Yes, WPS Office provides excellent VBA compatibility. You can easily open macro-enabled files, run existing macros, and edit the code using the built-in VBA editor, providing a seamless experience for automated tasks.





