+ Reply to Thread
Results 1 to 5 of 5

Cell Value = TextBox1.Value + TextBox2.Value

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Cell Value = TextBox1.Value + TextBox2.Value

    Good day,
    I know this should be as simple but I'm a little lost here.

    I have a userform that has two Textbox.
    TextBox1 = a calendar popup that will insert the date in Textbox1
    Textbox2 = a simple "numberonly" format that the user will enter.

    Example: TextBox1 will = to 2013-07-24 and TextBox2 will = to let's say "2"

    I need that when I click on my "Add" form button to Calculate Textbox1 (Date) = TextBox2 (number)

    Therefore the final result in my Sheet cell will equal to 2013-07-26

    This is my Code in my userform:

    Cells(ActiveCell.Row + 1, "V").Value = (TextBox4.Value) + (TextBox5.Value)
    The output I am getting is the following:

    Cells(ActiveCell.Row + 1, "V").Value = 2013-07-24+2

    What Am I doing wrong?

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Cell Value = TextBox1.Value + TextBox2.Value

    TextBox4.Value is a text, not a number, you can not sum texts, you have to convert them to numbers
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Cell Value = TextBox1.Value + TextBox2.Value

    What would be an alternative approach?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Cell Value = TextBox1.Value + TextBox2.Value

    Are you trying to add the no of days from Textbox5 to the date in Textbox4?
       Cells(ActiveCell.Row + 1, "V").Value= DateAdd("d", TextBox5.Value, DateValue(TextBox4.Value))
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Cell Value = TextBox1.Value + TextBox2.Value

    YES NORIE,
    Thank you so Much.

+ 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] textbox1 * textbox2 = textbox3
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-23-2012, 03:35 PM
  2. Choose 4 Random Numbers if they are not textbox1 or textbox2
    By blitz74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2012, 02:41 AM
  3. [SOLVED] TextBox1 = TextBox2
    By Anto_BT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2012, 03:34 AM
  4. Select & Delete text in TextBox1 also deletes text in TextBox2
    By heinousanus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2006, 08:02 PM
  5. [SOLVED] When data in TextBox2 matches data in TextBox1
    By Maddoktor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2005, 02:00 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