VBA & Macro Problems

Fix Excel UserForm ListBox Crashes When Adding Table Rows

Anum MushtaqAnum Mushtaq Nov 18, 2026 868 views

Question details

Prevent Excel from closing unexpectedly when a UserForm adds rows to a table connected to a ListBox.

Fix Excel UserForm ListBox Crashes When Adding Table Rows
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.
Before you start

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.

Solution 1Recommended

Disconnect the ListBox RowSource Before Adding a Table Row

Use this approach when the ListBox is bound to the table that the UserForm modifies.

1
Open the button code

Open Developer > Visual Basic, locate the UserForm in Project Explorer, and open the code for the button that adds the table row.

2
Disconnect and update the table

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

3
Reconnect the updated range

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.

4
Test the form

Run the UserForm, use its add-row button, and check that the new row appears in both the table and ListBox without Excel closing.

Disconnect the ListBox RowSource Before Adding a Table Row
Adapt the example: Replace Sheet1, Table1, ListBox1, and TextBox1 with your actual names. If an error interrupts the update, the ListBox may remain disconnected; review the VBA error before reconnecting it.
Free Microsoft Office alternative

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.

Open and edit Excel spreadsheet formats, including XLSX and XLSWork with table data in a familiar spreadsheet interfaceUse a free, lightweight alternative for everyday Office tasksMove common spreadsheet workflows without starting from scratch
microsoft office alternative - wps office

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.