Consulting

Results 1 to 4 of 4

Thread: Solved: Using 2nd value of listbox

  1. #1
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location

    Solved: Using 2nd value of listbox

    With [VBA]userform1.listbox1.value[/VBA] you can get the value of the first column in a listbox.
    How can I use the 2nd or third value of a row in a listbox.

    Something like [VBA]userform1.listbox1.item(2).value[/VBA]. This refers to column no2 of the row that was selected in the listbox.

    Needed for duplicate items in the first column. I can't use a vlookup for the rest of the info because of this.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you mean multiple selections

    [vba]


    With Me.ListBox1
    For i = 0 To .ListCount - 1
    If .Selected(i) Then
    Msgbox .List(i)
    End If
    Next i
    End With
    [/vba]

  3. #3
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    If you want the second column,

    [VBA]
    userform1.listbox1.Column(1)
    [/VBA]

  4. #4
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location

    using info in 2nd column of listbox

    Quote Originally Posted by geekgirlau
    If you want the second column,


    [vba]
    userform1.listbox1.Column(1)
    [/vba]
    Thanks !!!

    Charlize

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •