Results 1 to 8 of 8

Wrong result adding values of text boxes in a userform.

Threaded View

  1. #1
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Wrong result adding values of text boxes in a userform.

    Hello

    I am not able to understand this.

    I have 4 text boxes in a user form where user type numbers. At the end i have another text box(yellow one) that adds these numbers using this code.
    Dim x As Integer, Tot As Double
        Me.TextBox5.Text = ""
        For x = 1 To 4
        Tot = Tot + Val(Me("prcase" & x).Text)
        Next x
        Me.TextBox5.Text = Tot
    In another text box(grey one) user types another number.

    Then using this code

    Private Sub TextBox6_Change()
    TextBox7.Text = Val(TextBox5.Text) + Val(TextBox6.Text)
    End Sub
    i try to add the values of the two previous text boxes.

    I get wrong result when i use decimals numbers and i can not understand what is wrong.

    Thanks in advance for any assistance here.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with code for userform text boxes, combo boxes and excel
    By innerise in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 09:07 AM
  2. [SOLVED] Populate cell values into 6 named text boxes in a userform then edit if required
    By How How in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-05-2013, 05:51 AM
  3. Replies: 17
    Last Post: 10-14-2012, 11:15 AM
  4. [SOLVED] Need code to add values from 2 text boxes and place result in a label.
    By egavasrg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2012, 08:12 PM
  5. Adding text boxes in userform
    By jcarstens in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-10-2009, 02:23 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