Fix a VBA Edit Button That Does Not Update Excel Records
Question details
The user needs an Excel VBA UserForm Edit button to update the selected worksheet record.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user changes values in a UserForm and clicks Edit to update an existing worksheet row.
- Observed behavior
- The Edit button may appear to do nothing because the code does not find the intended record, write the form values to the correct cells, or save the changes.
Identify the Edit button, the worksheet containing the records, and the field that uniquely identifies each record. Open the workbook in desktop Excel and confirm that macros are permitted for this trusted file.
Trace the Edit button and correct the record update
Use this approach to find where the UserForm stops and ensure that edited values are written to the intended row.
Open the Visual Basic Editor with Alt+F11, open the UserForm, and double-click the Edit button. Confirm that its Click event contains the update code or calls the intended update procedure.
Click in the event procedure and press F9 to set a breakpoint. Run the form, select a record, click Edit, and use F8 to step through the code. Check that the selected record's unique ID resolves to a valid worksheet row.
In the update procedure, check the workbook and worksheet references and confirm that each form control's value is assigned to the appropriate column in the selected row. Check that required fields are valid before the assignments run.
Run the form again, change a value, and click Edit. Check the corresponding worksheet row, then use File > Save to save the workbook. If it contains VBA, save it in a macro-enabled format such as .xlsm.

Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday spreadsheet work between applications. It does not fix Excel's VBA event code, and macro support can vary by version.

Frequently Asked Questions
How can I tell whether the Edit button runs its VBA code?
In the Visual Basic Editor, open the UserForm, double-click the Edit button, and press F9 in its Click event. Run the form and click Edit; Excel should pause at the breakpoint if that procedure runs.
Why does the button update the wrong row?
The row number may be based on an incorrect selection or lookup. Step through the Click procedure with F8 and check that the selected record's unique ID maps to the intended row on the intended worksheet.
Why do my changes disappear after I close the workbook?
Check that the code writes the form values to worksheet cells, then use File > Save before closing. Save the workbook as .xlsm if it contains VBA that you need to retain.
Can WPS Office fix the Excel VBA button?
No. The button's event procedure and worksheet references must be checked in Excel. WPS Office can be used as an alternative for common spreadsheet tasks, but VBA support varies by version.




