+ Reply to Thread
Results 1 to 9 of 9

Add number of text boxes inside a UserForm

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

    Add number of text boxes inside a UserForm

    Hello

    I have a UserForm(UserForm5) that create some calulations depanted of what user choosed.

    I use this code for the calculation and works creat.

    Please Login or Register  to view this content.
    When i try to add the results of some textboxes i get as result only the number of the first textbox.

    Please Login or Register  to view this content.
    Any idea for this?

    Thnks in advance for any assistance!
    Attached Files Attached Files

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Add number of text boxes inside a UserForm

    This may seem a little long, but prevents errors.

    Please Login or Register  to view this content.
    The reason why your code wasn't adding up is because textbox17's value is being formatted as text after the first line.

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

    Re: Add number of text boxes inside a UserForm

    The problem is textbox property Value is a string variable and + is a valid string operation performing concatention

    So if you enter the values 14, 16 and 26 into the 3 textboxes this is how it is processed

    Please Login or Register  to view this content.
    And not 56.

    You need to convert the contents into numeric values first, probably use a function so you can handle empty or non numeric content.
    Cheers
    Andy
    www.andypope.info

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

    Re: Add number of text boxes inside a UserForm

    Thank you very much both of you.

    millz

    Unfortunately this does not works as you can see in the video attachment.

    Andy

    Yes as i see this is the problem. As you probably noticed(in my sample workbook) to get the values in TextBoxes 16 & 19 from sheet "Spairs" i use this pice of code.
    Please Login or Register  to view this content.
    So any idea of how can i solve this issue?

    http://screencast.com/t/a1v7t6m8rGl

  5. #5
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Add number of text boxes inside a UserForm

    Hi,

    Just do this :

    Please Login or Register  to view this content.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

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

    Re: Add number of text boxes inside a UserForm

    Thank you xlbiznes.

    This works for the quantities text box but not for the values sum.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    This does not works.

    Any idea?

  7. #7
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Add number of text boxes inside a UserForm

    Hi,

    try this now :

    Please Login or Register  to view this content.

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

    Re: Add number of text boxes inside a UserForm

    Yes. That's it. Works Great. Thank you for that!

    Now i am hoping that i'll be able to use it in my original workbook that is exactly the same as my sample but has 20 lines of textboxes!!

  9. #9
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Add number of text boxes inside a UserForm

    You are welcome, Glad i could help
    Last edited by xlbiznes; 12-13-2013 at 06:52 AM.

+ 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. [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. Text Boxes On UserForm vs Wizard
    By stuu3270 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2013, 07:09 PM
  3. multiple text boxes on userform
    By stephen1000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2009, 03:37 AM
  4. Linking text boxes in UserForm
    By KA_Analyst in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-13-2007, 05:07 PM
  5. Using userform, text boxes
    By Momo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2005, 12:06 PM

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