PDA

View Full Version : [SOLVED:] Select from userform listbox



gibbo1715
09-20-2005, 01:11 PM
More Questions

I am using the code below to select the content of column 1 in my multi listbox


Private Sub ListBox1_Click()
If Me.ListBox1.Text <> "" Then
MsgBox Me.ListBox1.Text
End If
End Sub

My question is how to i select column 3

Thanks

Gibbo

gibbo1715
09-20-2005, 02:13 PM
This works for what i want


For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
MsgBox ListBox1.List(i, 4) & " is selected"
End If
Next

thanks for looking

Gibbo

Killian
09-20-2005, 02:15 PM
You can refer to rows and columns of a list item with List(row,col)


Private Sub ListBox1_Click()
With Me.ListBox1
If .Text <> "" Then
MsgBox .List(.ListIndex, 2)
End If
End With
End Sub


/edit OK... you worked it out before I go there :) - but how does using column index 4 refer to the 3rd column? (especially since it starts at 0)

gibbo1715
09-20-2005, 02:23 PM
Thanks Killian, just seen your post

Appreciate the help

Gibbo