PC Review


Reply
Thread Tools Rate Thread

combobox multiple columns

 
 
=?Utf-8?B?R3JhaGFtIFk=?=
Guest
Posts: n/a
 
      25th Sep 2007
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?
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      25th Sep 2007
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)

"Graham Y" <(E-Mail Removed)> wrote in message
news:A57D0DEF-FAE3-468B-BA5A-(E-Mail Removed)...
>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?



 
Reply With Quote
 
=?Utf-8?B?R3JhaGFtIFk=?=
Guest
Posts: n/a
 
      25th Sep 2007
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.

"Bob Phillips" wrote:

> 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)
>
> "Graham Y" <(E-Mail Removed)> wrote in message
> news:A57D0DEF-FAE3-468B-BA5A-(E-Mail Removed)...
> >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?

>
>
>

 
Reply With Quote
 
Andy Pope
Guest
Posts: n/a
 
      25th Sep 2007
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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Graham Y" <(E-Mail Removed)> wrote in message
news:0EEEE57D-25F1-4F2B-AE2F-(E-Mail Removed)...
> 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.
>
> "Bob Phillips" wrote:
>
>> 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)
>>
>> "Graham Y" <(E-Mail Removed)> wrote in message
>> news:A57D0DEF-FAE3-468B-BA5A-(E-Mail Removed)...
>> >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?

>>
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB2005 Combobox w/ Checkmarks and Multiple Columns DIOS Microsoft VB .NET 1 2nd Apr 2009 05:45 PM
Multiple Columns in Forms.ComboBox.1 =?Utf-8?B?Q2Fu?= Microsoft Access Form Coding 0 30th Jan 2006 02:06 PM
Multiple columns in Combobox list =?Utf-8?B?S2VpdGggRw==?= Microsoft VB .NET 5 10th Jan 2006 05:44 PM
ComboBox with multiple columns George Gîta Microsoft ADO .NET 1 22nd Sep 2004 09:52 AM
Combobox Display - Multiple Columns? Craig Microsoft Dot NET 1 31st Dec 2003 03:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 AM.