Milti Column Combobox

G

Guest

I have a form with a multicolumn combobox (CBNames). it gets its list from
columns a, B, and C of a worksheet. (Number, FirstName, LastName) i have the
column count set at 3, and the column widths set appropriately. when a user
clicks the arrow to "Drop Down" the combobox, and he/she selects an item from
the list, what is shown in the box is just the number, the first column. is
there a way to get it to display all 3 items for that row in the combobox
after it is selected? TIA
 
K

keepITcool

you can select 1 column to be displayed
when the combobox is not 'dropped'.

You do this by setting the TextColumn = 2
and it will show the second column.

To display the concatenated name you'd have to include
a fourth column with the data you want displayed.

If you dispense with the convenience of
using ListFillRange but populate the combo's list
yourself then you dont need need to change your actual data.

Sub Combofill()

Dim itm As Range

With Me.ComboBox1
'this ought to be set in designer
.ListFillRange = ""
.ColumnCount = 4
.ColumnWidths = "18pt;72pt;72pt;0"
.BoundColumn = 1
.TextColumn = 4

'this would normally run
.Clear
For Each itm In Range("a1:a40")
If itm(1, 1) <> "" Then
.AddItem itm(1)
.List(.ListCount - 1, 1) = itm(1, 2)
.List(.ListCount - 1, 2) = itm(1, 3)
.List(.ListCount - 1, 3) = itm(1, 2) & ", " & itm(1, 3)
End If
Next
End With
End Sub






--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Virginia wrote :
 

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

Similar Threads


Top