View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ironhydroxide ironhydroxide is offline
external usenet poster
 
Posts: 51
Default 2 Column ListBox, Selection data


..ListIndex That is what i needed. Thanks a ton

ironhydroxide

"Dave Peterson" wrote:

This worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()
With Me.ListBox1
If .ListIndex < 0 Then
Exit Sub 'nothing selected
End If

MsgBox .List(.ListIndex, 0) & vbLf & .List(.ListIndex, 1)
End With
End Sub
Private Sub UserForm_Initialize()
With Me.ListBox1
.ColumnCount = 2
.ColumnWidths = "33;33"
.List = Worksheets("sheet1").Range("A1:B5").Value
End With
End Sub



ironhydroxide wrote:

I have a 2Column Listbox. I do not know how to get both columns to
variables, i have tried multiple ways and can seem to only get the first
column (which the User has Highlighted) into a variable. How do i get both
values (either in Lines down, or in a string format) into either two
variables or an array. Thanks

Ironhydroxide


--

Dave Peterson