arnabmit
New Member
- Joined
- Mar 28, 2009
- Messages
- 27
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I have lstPrev as an ActiveX Listbox. It has 10 rows of data. Once the user selects a row (single select) and presses the delete button, it should delete the corresponding row in dbTable.
I think I am making some stupid mistake in the logic here...
I think I am making some stupid mistake in the logic here...
Code:
Sub DelRows()
Dim i As Integer
Set i = ActiveSheet.lstPrev.ListIndex + 1 'to ensure column headers are not deleted
dbTable.ListRows(i).Delete
End Sub