Results 1 to 13 of 13
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Numbers in a ListBox (XL97:SR2)

    How does one get numbers to display in a listbox that are lined up with the decimal place

    The following is NOT what it should look like.
    123.45
    23.45
    11223.45


    Thanks,
    John

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    A listbox from the controls toolbar can be told to align right with its textalign property.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    Jan,

    The listbox is generated within a UserForm and not the controls toolbar. I did not see a textalign property within the UserForm's listbox.

    John

  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: Numbers in a ListBox (XL97:SR2)

    I see it in my version of XL97 SR2.
    Do you have the "Properties Window" open? (F4 or View - Properties window)

    or you can do it via VB (change list bax name as appropriate):
    ListBox1.TextAlign = fmTextAlignRight

    Steve

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    In the VB Editor window, if you don't have a properties box displayed, then right click in the listbox and click on Properties in the pop up menu. The properties window should appear with one of the properties being TextAlign.
    Legare Coleman

  6. #6
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    Steve,

    It must be Monday all over again. I can't seem to locate the TextAlign property. If I try changing the property via code an error message is returned: "object does not support this property or method".

    John

  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: Numbers in a ListBox (XL97:SR2)

    How about this?
    Steve
    Attached Images Attached Images

  8. #8
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    Steve,

    One would only think it was that simple. This is what I have.
    Attached Images Attached Images

  9. #9
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Numbers in a ListBox (XL97:SR2)

    Are you sure that you have XL97 SR2? I have SR1 and like you, I have no TextAlign property. -- Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  10. #10
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Numbers in a ListBox (XL97:SR2)

    Sam,

    I definitely have XL97:SR2.

    John

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

    Re: Numbers in a ListBox (XL97:SR2)

    Steve, this is strange. I have Excel 97 SR2 (Dutch), and just like JStevens and SammyB, I don't see the TextAlign property for a list box. If I look up TextAlign in the online help, Applies To says that TextAlign is a property of a ComboBox, Label and TextBox. No mention of a ListBox. The Object Browser doesn't list TextAlign as a property of a ListBox either...

  12. #12
    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: Numbers in a ListBox (XL97:SR2)

    I responded at work where I have
    Excel 97 SR-2 (l): I think it is an "el" in the parentheses. The font has a cap on the 1 in the dialog box. This has TextAlign.

    I checked at home where I have:
    Excel 97 SR-2: there is no "(l)". I don't know what difference the "sub-version" is. At home I did discover that I have NO TextAlign.

    So this "later" revision might have the "addition".

    Also, I don't know if there is any difference between VB references. At work I get what they install: (MS097.dll, FM20.dll, stdole2.tlb, excel8.olb, and VBA332.dll).

    I can't compare at home until after work to see if any are different.

    Steve

  13. #13
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Numbers in a ListBox (XL97:SR2)

    Just to confirm Hans, I upgraded last night to 97 SR2. I still do not have a text align property for a listbox, but I do have it for a combobox. I guess you'll have to use a combobox. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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