+ Reply to Thread
Results 1 to 6 of 6

Help with decimals in userform

  1. #1
    Registered User
    Join Date
    03-15-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Help with decimals in userform

    Hi all, Just started with vba and need help with a calculation in a userform.
    My userform is calculating the sales taxes for an amount given.
    I want only 2 decimals of the calculated amount in my Textbox4 after I click the commandbutton1.

    I does calculate fine but no matter what I write like "format" or anything else, it always gives me several decimals and often creates a bug.
    This is my code as of now without any "format":

    Please Login or Register  to view this content.
    What can I do or write to receive a result of 2 decimals after the calculation is done?

    Many thanks in advance for your help.
    Regards
    Leweez
    Last edited by JBeaucaire; 03-12-2016 at 12:07 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with decimals in userform

    This tip goes for VBA and for worksheet formulas.

    When multiplying long decimal $ values, always apply Rounding to the results.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-15-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Help with decimals in userform

    Wow! that was fast! and it works like a charm!
    Many many thanks!

    Regards
    Leweez

  4. #4
    Registered User
    Join Date
    03-15-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Help with decimals in userform

    Again, many thanks for your help!
    Regards
    Leweez
    Last edited by Leweez; 03-12-2016 at 12:36 PM.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with decimals in userform

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

  6. #6
    Registered User
    Join Date
    03-15-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Help with decimals in userform

    Ok, thank you for the Thread Tools advise.
    Regards
    Leweez

+ 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. Replies: 2
    Last Post: 02-13-2015, 07:36 AM
  2. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  3. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  4. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  5. userform is large.....how to use scrollbar of userform to show all of the userform
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2010, 04:11 PM
  6. Decimals
    By Dohko in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2007, 11:53 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