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.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,018
Messages
5,834,976
Members
430,331
Latest member
Syed Yasir Hannan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top