Dynamic Multi Column ListBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I don't know if this is possible, but I hope some can help.

I want to create a "Dynamic Multi Column ListBox" that consits of 2 columns
and then only returns the value in the 1st column. Example:

A1 = 1 - B1 = One
A2 = 2 - B2 = Two
A3 = 3 - B3 = Three

Dynamic ListBox =

1 One
2 Two
3 Three

If the user selects "2 Two" it returns the value of 2 to the appropriate cell.

As always, Any helps is truly appreciated.
 
Hi,

Something like this may help.
You need to set the listbox property column count to 2 and column width to
49.95 pt;0.25 pt.

Private Sub ListBox1_Click()
For k = 0 To UserForm1.ListBox1.ListCount
If UserForm1.ListBox1.Selected(k) Then
Range("C1").Value = UserForm1.ListBox1.List(k) &
UserForm1.ListBox1.List(k, 1)
End If
Next
End Sub

Charles
 
Charles Harmon said:
Hi,

Something like this may help.
You need to set the listbox property column count to 2 and column width to
49.95 pt;0.25 pt.

Private Sub ListBox1_Click()
For k = 0 To UserForm1.ListBox1.ListCount
If UserForm1.ListBox1.Selected(k) Then
Range("C1").Value = UserForm1.ListBox1.List(k) &
UserForm1.ListBox1.List(k, 1)
End If
Next
End Sub

Charles
 
Yes,
Just change this :
Range("C1").Value = UserForm1.ListBox1.List(k) & UserForm1.ListBox1.List(k,
1)
To:
Range("C1").Value = UserForm1.ListBox1.List(k)

Charles
 
Charles Harmon said:
Yes,
Just change this :
Range("C1").Value = UserForm1.ListBox1.List(k) & UserForm1.ListBox1.List(k,
1)
To:
Range("C1").Value = UserForm1.ListBox1.List(k)

Charles


Charles:

PERFECT! Thanks for your help.

Ronbo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top