-
Solved: help getting listindex from listbox
hi,
i cannot seem to get this working. the objective is to delete the contents of a certain row based on what the user is selecting from a listbox
[vba]
Private Sub CommandButton1_Click()
Dim nRow As Double
Dim record As Range
Dim sheet As Worksheet
Set sheet = ThisWorkbook.Worksheets("TABLES")
If tbl_incidencia.ListIndex = -1 Then
' DISPLAY ERROR MESSAGE IF NOTHING IS SELECTED
Else
nRow = tbl_incidencia.ListIndex
Set record = sheet.Range(Cells(nRow, 4), Cells(nRow, 11))
record.Select
' CLEAR CONTENTS FROM SELECTION
End If
End Sub
[/vba]
getting "application defined or object defined error"
i dont understand why i get this error
i feel like an idiot bumping on almost every little code snippet lately... i really appreciate you guys helping me.
-
found the problem.
in case you're curious, had to refer the list box like userform.listbox.property
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules