Multi Line on Combo Box

jon_poole

New Member
Joined
Sep 21, 2005
Messages
8
Hi folks,

I'm using a combo box in a userform to allow user selection of text strings. Unfortunately some of the text strings are very long and keeping them on one line looks remarkably daft.

Searching through previous posts on this (frankly quite brillaint) board threw up the mutliline property for text boxes, but I can't find an equivalent for combo boxes, is this something that can be coded or am I trying the impossible?

any help/advice would be much appreciated!

many thanks.
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
Hi jon_poole,

I don't believe that a combobox or listbox control can wrap lines--the reason probably being that each line would appear to be a separate selectable item.

What I suggest you do is use a textbox with wrapping to display the currently selected item in the combobox. That way you can display the items in the combobox with a narrow width, but when the item is selected you can see the entire text. Use code such as the following:

Private Sub ComboBox1_Change()
TextBox1.Text = ComboBox1.Value
End Sub

And you will need to set both the MultiLine and WordWrap properties of the textbox to TRUE.
 

jon_poole

New Member
Joined
Sep 21, 2005
Messages
8
Yes! that's great.

I was edging towards giving up on the userform and just validating it straight to a sheet (which would have been much less pretty and much more of a pig to deal with amending the data).

cheers for the advice!

Jon
 

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,083
Members
412,566
Latest member
TexasTony
Top