Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 Column ListBox, Selection data
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 Column ListBox, Selection data
Maybe this:
http://www.contextures.com/xldataval02.html http://www.contextures.com/xlDataVal13.html HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 Column ListBox, Selection data
Apparently I was not clear in my orignal Post. I have a 2Column ListBox in
my Userform. and so the links dont help me at all. but thanks anyway. "ryguy7272" wrote: Maybe this: http://www.contextures.com/xldataval02.html http://www.contextures.com/xlDataVal13.html HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
2 Column ListBox, Selection data
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listbox Selection Displays the Column. | Excel Worksheet Functions | |||
Listbox Selection Displays the Column. | Excel Worksheet Functions | |||
Listbox Selection Displays the Column. | Excel Worksheet Functions | |||
Listbox Selection Displays the Column. | Excel Worksheet Functions | |||
displaying selection data from a listbox | Excel Programming |