+ Reply to Thread
Results 1 to 9 of 9

Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    46

    Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    HI all, I'm new in Excel VBA,

    I have one userform to calculate example : (Texbox1 = Textbox2 + Texbox3) (In texbox1 is Rezultat, Need to Calculate Texbox2 + Texboxt3) with Decimales... Example if I want to calculate example 0.50 + 1 hi type rezultat only 1 Not 1.5 (1.50) Or if I type 2.5 (2.50) Hi Calculate only 2 not 2.50,
    Example if Texbox2 is 0.50 and Texbox3 is 2, after Calculate Texbox2 + Texbox3 Resultats is again only 2, not 2.50 (2,50)


    So Plz See me Example Form in atachments and regulating the problem for me because i am very new to Excel/VBA.

    Thank You.
    Attached Files Attached Files
    Last edited by johan12; 05-29-2012 at 03:32 PM.

  2. #2
    Registered User
    Join Date
    04-09-2012
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    johan12,

    Try this code in your butonn:

    Please Login or Register  to view this content.

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

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    A TextBox is by default a String so you need to convert to a Numeric value, e.g.

    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

  4. #4
    Registered User
    Join Date
    06-03-2011
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    I try, but nothing Again not work... any idea.... thanks...

  5. #5
    Registered User
    Join Date
    04-09-2012
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    johan12,

    What hapenned when you use my code?

  6. #6
    Registered User
    Join Date
    06-03-2011
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    Quote Originally Posted by Pulsus View Post
    johan12,

    What hapenned when you use my code?
    When use your code Rezultat is example : IF 5.50 + 1 = 7, not 6.50 , Or if 0.50 + 1 = Rezultat is = 2, Not 1.5

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    Johan12,

    Sorry, as I am not a native english speaker I understand that you want the opposite, try this code:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-03-2011
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    Pulsus,

    Thanks a LOT , this code Working Prefect... THANKS again...

  9. #9
    Registered User
    Join Date
    04-09-2012
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Calculate with Decimal in UserForm (Texbox1 = Textbox2 + Texbox3)

    Johan12,

    Good to know. You are welcome.

+ 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