combobox multiple columns

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

Guest

I use the following code to populate a combobox (on a userform) with a list
of names and associated numbers (colour codes)
Dim BuMs()
ReDim BuMs(y, 1)
BuMs(1,0)="Fred"
BuMs(1,1)=1
cmbBuMs.List = BuMs
The combobox displays the names, but when I process the form, I also want to
use the colur code, how do I access it?
 
I think you will be unlucky with that one.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Thanks Bob
Was hoping I might have missed something.
I'll just have to use the index to look the value up from the array.
 
Hi,

Can you not make use of the boundcolumn?

Private Sub UserForm_Initialize()

Dim BuMs(), y

y = 3

ReDim BuMs(y, 1)
BuMs(1, 0) = "Fred"
BuMs(1, 1) = 1
BuMs(2, 0) = "John"
BuMs(2, 1) = 3
BuMs(3, 0) = "Mike"
BuMs(3, 1) = 5

cmbBuMs.List = BuMs
cmbBuMs.BoundColumn = 2

End Sub
Private Sub cmbBuMs_Change()

MsgBox cmbBuMs.Text & vbLf & cmbBuMs.Value

End Sub

Cheers
Andy
 

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