Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    list box formatting (2003)

    I have a list box with 5 columns. Can somebody please advise how I can control the column width of each of the columns.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: list box formatting (2003)

    Is this
    a) a list box on a worksheet created from the Forms toolbar
    [img]/forums/images/smilies/cool.gif[/img] a list box on a worksheet created from the Control Toolbox
    c) a list box on a userform

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: list box formatting (2003)

    A list box on a form

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: list box formatting (2003)

    Change the columnwidths property.
    Enter the points (72 pts/inch) of each column separated by a semicolon (or use abbr for other units)
    from Help:
    <hr>
    Setting Effect
    90;72;90 The first column is 90 points (1.25 inch); the second column is 72 points (1 inch); the third column is 90 points.
    6 cm;0;6 cm The first column is 6 centimeters; the second column is hidden; the third column is 6 centimeters. Because part of the third column is visible, a horizontal scroll bar appears.
    1.5 in;0;2.5 in The first column is 1.5 inches, the second column is hidden, and the third column is 2.5 inches.
    2 in;;2 in The first column is 2 inches, the second column is 1 inch (default), and the third column is 2 inches. Because only half of the third column is visible, a horizontal scroll bar appears.
    (Blank) All three columns are the same width (1.33 inches). <hr>

    Steve

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: list box formatting (2003)

    A list box has a ColumWidths property. Example:
    <code>
    Me.ListBox1.ColumnWidths = "20;60"
    </code>
    This sets the width of the 1st column of ListBox1 to 20 points and that of the 2nd column to 60 points (1 inch = 72 points)

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: list box formatting (2003)

    Does it matter?

    I thought columnwidths is essentially the same for Control Toolbox or on Userforms and the one from FORMS toolbar does not do column widths?

    Steve

  7. #7
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: list box formatting (2003)

    Ahh, I was thinking manually changing it in "Properties". VB Coding is different for the 2 different types...

    Steve

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: list box formatting (2003)

    You're correct, but I wanted to make sure we were talking about the same thing.

  9. #9
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: list box formatting (2003)

    Thanks

    It is so simple when you know how/where to look. I spent at least an hour trying t sort this out.

Posting Permissions

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