Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox Selection Displays the Column. Scott Halper Excel Worksheet Functions 3 February 3rd 07 10:36 AM
Listbox Selection Displays the Column. Scott Halper Excel Worksheet Functions 0 February 1st 07 08:50 PM
Listbox Selection Displays the Column. Scott Halper Excel Worksheet Functions 0 February 1st 07 08:50 PM
Listbox Selection Displays the Column. Scott Halper Excel Worksheet Functions 0 February 1st 07 08:50 PM
displaying selection data from a listbox Mats Samson Excel Programming 4 July 5th 05 04:08 PM


All times are GMT +1. The time now is 09:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"