+ Reply to Thread
Results 1 to 7 of 7

Listbox Formatted to 2 Decimal Places

  1. #1
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Listbox Formatted to 2 Decimal Places

    Listbox2 is populated from worksheet R1 which is formatted as currency (£) to 2 decimal places. Listbox2 displays the result with 4 decimal places. Is there further code I can add to this so that Listbox2 displays the result with only 2 decimal places?


    Please Login or Register  to view this content.
    Last edited by zimbo109; 10-04-2010 at 11:37 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Listbox Formatted to 2 Decimal Places

    Try This
    Please Login or Register  to view this content.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Listbox Formatted to 2 Decimal Places

    Your description is that you are getting values from worksheet R1, but your code shows that you are accumulating values from 11 different worksheets.

    If it were one worksheet, I would suggest that you set the ListFillRange property of the listbox to the range you want values from, instead of loading them in code.

    In the code you have provided, you are loading the actual values, regardless of how they are formatted in the cells. I would suggest you use

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Listbox Formatted to 2 Decimal Places

    Thanks Dave, works! but the code changes the bit 0.00 to 0# and I lose all decimal places??

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Listbox Formatted to 2 Decimal Places

    Please Login or Register  to view this content.



  6. #6
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Listbox Formatted to 2 Decimal Places

    Thanks 6 string - works a treat.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Listbox Formatted to 2 Decimal Places

    Why two ListBoxes?

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1