+ Reply to Thread
Results 1 to 7 of 7

Problems with "Adding" in userforms

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Gdansk, Poland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Problems with "Adding" in userforms

    Hi guys,

    I know this may be silly but anyway...

    when I do simple calculations in userforms:
    TextBox1.Value + TextBox2.Value
    and use CommandButton to add the two values i get the two values next to each other, like this:

    1 + 1 = 11 instead of 1 + 1 = 2

    The problem is only with adding
    When i use - * or / it works fine

    Could anyone provide a solution?
    Thanks in advance!

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Problems with "Adding" in userforms

    when used with text + is considered concatenation.

    Try converting the contents of the textboxes to numeric values before adding
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Gdansk, Poland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Problems with "Adding" in userforms

    thanks.

    maybe you happen to know the command to do so?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Problems with "Adding" in userforms

    VAL or CLNG or CDBL depending on the content

  5. #5
    Registered User
    Join Date
    10-26-2012
    Location
    Gdansk, Poland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Problems with "Adding" in userforms

    appologies for being a pain... but could you kindly modify the below code so i could paste it to my userform:

    current command is:

    TextBox3.Value = TextBox1.Value + TextBox2.Value

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Problems with "Adding" in userforms

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-26-2012
    Location
    Gdansk, Poland
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Problems with "Adding" in userforms

    thanks man! perfect!
    i must have slept that over on a training...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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