Consulting

Results 1 to 3 of 3

Thread: Solved: Combobox column width

  1. #1
    VBAX Contributor
    Joined
    May 2007
    Posts
    128
    Location

    Solved: Combobox column width

    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

  2. #2
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    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
    Last edited by paulked; 06-08-2007 at 11:26 AM.
    Semper in excretia sumus; solum profundum variat.

  3. #3
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    In the other forum it said that it was not possible to automatically adjust the ListWidth?

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

    This 700 could obviously be a variable determined by the maximum width of column B
    Semper in excretia sumus; solum profundum variat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •