How to Fix Excel Cell Contents Repeating Instead of Being Replaced
Question details
The user needs to resolve an issue where cell contents duplicate or repeat instead of being overwritten upon editing, and the Undo function becomes disabled.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Editing cells in a workbook containing active VBA macros.
- Observed behavior
- Cell contents duplicate or repeat instead of being replaced, and normal Undo history is disabled due to background macro execution.
Before troubleshooting VBA scripts, ensure you save a backup copy of your original workbook to prevent accidental loss of important macros or data.
Identify and Correct Problematic VBA Event Macros
Disable macros to confirm they are the cause, then locate and fix the specific event procedure triggering the duplication.
When Excel duplicates cell contents and disables Undo, a VBA event macro is usually modifying the cell immediately after an edit.
Open the affected workbook with macros disabled via the Trust Center to test if the cell duplication stops.
Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) Editor.
In the Project Explorer pane on the left, double-click the specific worksheet code module or the 'ThisWorkbook' module.
Look for 'Worksheet_Change' or similar event procedures that are scripted to modify cells after an edit.
Remove or modify the problematic code causing the duplication, then save the workbook.

Save as XLSX to Remove All VBA Macros
If you do not need any macros in your workbook, converting the file to a standard XLSX format will permanently remove all VBA code and resolve the issue.
Manage Workbooks and VBA Macros in WPS Spreadsheet
WPS Office provides a robust Spreadsheet application with a built-in VBA editor, allowing you to easily troubleshoot, modify, or remove macros from your Excel files.
- 1. Open Your Workbook: Open your affected macro-enabled workbook (.xlsm) in WPS Spreadsheet.
- 2. Access Developer Tools: Navigate to the 'Developer' tab on the top ribbon menu.
- 3. Open VBA Editor: Click 'Visual Basic' to open the VBA editor and locate the problematic 'Worksheet_Change' script.
- 4. Fix and Save: Edit or delete the macro, then easily save the document without losing format integrity.

Frequently Asked Questions
Why is the Undo button disabled after I type in an Excel cell?
This usually happens when a background VBA macro, such as a Worksheet_Change event, runs automatically immediately after a cell is edited. Standard macro execution inherently clears Excel's Undo history.
How do I safely test if macros are causing my cells to duplicate?
You can open the workbook in Safe Mode, or temporarily disable all macros in the Trust Center settings. If you attempt to edit the cells and the duplication stops, a macro is confirmed as the root cause.
Will saving my workbook as an XLSX file delete all my macros?
Yes. The standard XLSX format does not support VBA code. Saving an XLSM file as XLSX will permanently strip all macros from the new file, which acts as a quick fix if you no longer need the background scripts.




