PassSystems
New Member
- Joined
- Sep 19, 2020
- Messages
- 12
- Office Version
- 365
- Platform
- Windows
I am creating a spreadsheet for my business and have hit a snag. I have a UserForm (ApplianceDataForm) with a ListBox (ListTechnicianInfo) and I am trying to set up a row delete button. The ListBox has the RowSorce linked to a Table (Table_Technician) which is located in a worksheet named “Appliance Data”. This worksheet has several other tables in it.
I have set up a delete button in another UserForm ListBox that has the RowSource linked to a table that is the only one in the Worksheet. The following works very well:
I am however having problems with the second scenario. I assume it is the range and the subsequent deletion that I am having issues with.
Is there any help you can give me to stop me bashing my head against the desk… LOL
I have set up a delete button in another UserForm ListBox that has the RowSource linked to a table that is the only one in the Worksheet. The following works very well:
VBA Code:
Private Sub ButtonDeleteRow_Click()
Application.ScreenUpdating = False
Dim i As Integer
If MsgBox("Are you sure you want to delete this data row?", vbYesNo + vbQuestion, "Delete Row?") = vbYes Then
Worksheets("Appliance Test Data").Select
For i = 1 To Range("A100000").End(xlUp).Row
If Cells(i, 1) = TestDataList.List(TestDataList.ListIndex) Then
Rows(i).Select
Selection.Delete
End If
Next i
End If
Application.ScreenUpdating = True
End Sub
I am however having problems with the second scenario. I assume it is the range and the subsequent deletion that I am having issues with.
Is there any help you can give me to stop me bashing my head against the desk… LOL
Last edited by a moderator: