combo box with subtitles?

Microsoft Excel 2003 (full product)
September 10, 2009 at 09:46:25
Specs: Windows XP
is it possible to separate items in your drop down combo box with unselectable subtitles?
I'm using visual basic with excel.

See More: combo box with subtitles?

Report •

September 10, 2009 at 13:26:24

If you have a ComboBox in a User Form you can go to the properties of the ComboBox and enter 2 in the ColumnCount property

When you attach data to the combobox e.g. ComboBox1.List=strMyData()
Use an array with two dimensions, e.g. strMyData(9, 1)
The value 9 will be one less than the number of items in your drop-down list (remember that there is a zero element to the array) and 1 is for the two dimensions

In each of the two elements 0 and 1 enter your data and your subtitle.
Repeat for as many items in the list

Fill and Link the array to ComboBox1.List when the User Form's Initialize code is run.

The Combo box will now show your information with the 'subtitle' next to it.

The ComboBox BoundColumn property will determine if the value returned from the ComboBox is the first or second element, ie your data or your subtitle. Setting BoundColumn to 1 will ensure that it is the data that is returned not the subtitle.

The list will look like this:

Data A           Subtitle a
Data B           Subtitle b
Data C           Subtitle c
Data D           Subtitle d
Data E           Subtitle e
Data F           Subtitle f
Data G           Subtitle g

Report •

September 17, 2009 at 07:12:41
Thanks for your response.

Please clarify what is a "User Form" and how do I get there? I can't find the properties of the combobox?

Thank you!

Report •

September 17, 2009 at 07:37:21
I found the user form and changed columncount to 2!!

but the way I made my macro, I used Sheet1.ComboBox1.AddItem

how can I incorporate an array of two dementions with this format?

Thanks so much (sorry, I'm new at this)

Report •

Related Solutions

Ask Question