Fix Excel UserForm ListBox Crashes When Adding Table Rows
Question details
Prevent Excel from closing unexpectedly when a UserForm adds rows to a table connected to a ListBox.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A VBA UserForm displays an Excel table in a ListBox and adds a row to that table.
- Observed behavior
- Excel may close unexpectedly when the table changes while the ListBox remains connected to its range.
In Excel, open the VBA editor and identify the UserForm, ListBox, worksheet, table, and controls used to add a row. Confirm that the ListBox RowSource points to the table's data range.
Disconnect the ListBox RowSource Before Adding a Table Row
Use this approach when the ListBox is bound to the table that the UserForm modifies.
Open Developer > Visual Basic, locate the UserForm in Project Explorer, and open the code for the button that adds the table row.
Before calling ListRows.Add, set the ListBox RowSource to an empty string. Then add the row and write the form values to it. For example, adapt these names and assignments to your form: Dim ws As Worksheet, tbl As ListObject, newRow As ListRow Set ws = ThisWorkbook.Worksheets("Sheet1") Set tbl = ws.ListObjects("Table1") Me.ListBox1.RowSource = "" Set newRow = tbl.ListRows.Add newRow.Range.Cells(1, 1).Value = Me.TextBox1.Value
After writing all values, reconnect the ListBox to the table's updated data body: Me.ListBox1.RowSource = "'" & Replace(ws.Name, "'", "''") & "'!" & tbl.DataBodyRange.Address. Add assignments for any other table columns before this line.
Run the UserForm, use its add-row button, and check that the new row appears in both the table and ListBox without Excel closing.

Review Unload and Show Calls in the UserForm
Use this check if the button code unloads the current form and immediately shows it again.
Work With Excel Spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday spreadsheet work. It does not fix Excel's UserForm crash; check macro and UserForm compatibility before migrating VBA-dependent files.

Frequently Asked Questions
Why disconnect RowSource before adding a table row?
The ListBox remains linked to the table range through RowSource. Setting it to an empty string before ListRows.Add removes that connection while the table changes; reconnect it after the new row is populated.
What range should I reconnect the ListBox to?
Use the table's DataBodyRange for its data rows. After adding a row, set RowSource to a worksheet-qualified address for tbl.DataBodyRange, using your own worksheet and table references.
Does Unload Me followed by UserForm1.Show always cause a crash?
No. However, unloading and showing a form again can change which instance is in use. Review those calls in the button procedure and remove them if they are unnecessary.
Can WPS Office fix this Excel VBA crash?
No. The RowSource issue occurs in Microsoft Excel, so update and test the VBA code there. WPS Office can open common Excel files, but check VBA and UserForm compatibility before moving a macro-dependent workbook.




