Hello,

I am trying to add/delete rows to an existing table in the document based on user selection in the userform. I have the code working to add rows below the header row based on a _change event, but I am not able to figure out how to delete rows if the user selects for example "4" and then changes the combo box to "7". This will cause 11 rows to be added when only 7 are needed. I could probably assign the add rows to the cmdButton_click, but then if they reopened the userform and changed the selection I would still have the same problem.

Any help would be appreciated or if someone could point me in the right direction if this solution exists elsewhere that I haven't been able to find.

Public Sub cbArraySize_Change()

If cbArraySize.Value <> 0 Then
AddRows
DeleteRows '<---- This Sub I haven't figured out.

End If

End Sub


Sub AddRows()
With ActiveDocument

ActiveDocument.Tables(2).Rows(1).Select

Selection.InsertRowsBelow (cbArraySize.Value)

End With
End Sub