Consulting

Results 1 to 2 of 2

Thread: Solved: help getting listindex from listbox

  1. #1
    VBAX Regular
    Joined
    Sep 2012
    Posts
    13
    Location

    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.

  2. #2
    VBAX Regular
    Joined
    Sep 2012
    Posts
    13
    Location
    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
  •