PDA

View Full Version : Solved: Combobox column width



tqm1
06-08-2007, 12:59 AM
Reference:http://www.excelforum.com/showthread.php?t=602844

Dear Experts

On UserForm1, Combobox1 has two columns with data as follows

1 ASIA FLOUR MILLS BAHAWALPUR
2 AZIZ FLOUR MILLS BAHAWALPUR

When I dropdown the list then column2 does not display complete data.
I mean it show first line as
1 ASIA FLO

How to force listbox to autofit columns.
When I dropdown the combo then listbox should automatically wide.
The attachment is Source sheet and Userform with combbox.

Please help

paulked
06-08-2007, 11:16 AM
Use the ListWidth variable either in the Properties of the Combobox or write some code to find the largest cell in the column and set it to that.

Just followed your link... Naughty Naughty :bonk:

paulked
06-08-2007, 12:04 PM
In the other forum it said that it was not possible to automatically adjust the ListWidth?

I have just tried it with Private Sub UserForm_Initialize()
ComboBox1.ListWidth = 700
End Sub and it does the job!

This 700 could obviously be a variable determined by the maximum width of column B :confused: