+ Reply to Thread
Results 1 to 3 of 3

Round 2 decimal places

  1. #1
    Registered User
    Join Date
    07-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013 64bit
    Posts
    29

    Round 2 decimal places

    Hi, I just started practising VBA and have the following code

    Please Login or Register  to view this content.
    Pressing F5 results in curCommission giving me a Dollar value with four decimal places, which I would like to reduce to just two. I googled severel techniques, but non seemed to quite work.
    Why, for example, is putting
    Please Login or Register  to view this content.
    not doing the trick, but showing an error? Also, pressing F1 I see that dim As Currency should be 2 decimal places, why though are there in fact 4 decimal places in my case?


    Thank you.

  2. #2
    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: Round 2 decimal places

    Currency is a fixed-point number with four digits to the right of the decimal.

    Round is a function, not a statement. It returns a value. If you use the statement you provided above it will have no effect. You have to do something like this, to replace your second-from-last line of code:

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

  3. #3
    Registered User
    Join Date
    07-25-2013
    Location
    Germany
    MS-Off Ver
    Excel 2013 64bit
    Posts
    29

    Re: Round 2 decimal places

    great, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Round variable to 4 decimal places
    By achidsey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2014, 02:52 PM
  2. [SOLVED] Round numbers to decimal places
    By bigband1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-01-2013, 11:34 AM
  3. [SOLVED] Function to round up if more than 2 decimal places
    By lauralizzy in forum Excel General
    Replies: 1
    Last Post: 06-28-2012, 09:30 AM
  4. Round to two decimal places
    By golfnutte in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-08-2007, 05:48 PM
  5. [SOLVED] ROUND DATA TO 2 DECIMAL PLACES
    By roy in sunbury in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-12-2005, 12:06 AM

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