+ Reply to Thread
Results 1 to 8 of 8

Add textbox value if new and provide date if it is overwriting value of old

  1. #1
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Add textbox value if new and provide date if it is overwriting value of old

    I have a userform that inputs a textbox value into a sheet and the cell next to it creates the date when the value was added (this is done manually with formula). The textbox value is a name and I want two columns beside it to state when the original date the name was inputted and another column to insert a date if the the name was entered again.

    Here is my current code for adding the name:
    Please Login or Register  to view this content.
    Here is the formula I use for the date when first added:
    Please Login or Register  to view this content.
    I am showing my inexperience because I just copied the formula in over 11000 cells. I haven't put it into code yet. Is this possible to have both dates, or can I only have one or the other? I couldn't find the code or formula to add because the name doesn't overwrite the old one.

    This sheet is not really to be viewed by anyone, but the form I have on another sheet keeps track of it, so it can be messy.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Add textbox value if new and provide date if it is overwriting value of old

    Convert the formulas in column B to values so that they no longer are calculated.

    Then use code like this, and choose one of the two lines after
    If Not IsError(Res) Then
    to uncomment, depending on what you want to actually do.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: Add textbox value if new and provide date if it is overwriting value of old

    That works great thank you. I had to made a change so that it doesn't add a new column every time the name was entered, which I never really mentioned. I just wanted the two columns, which the third changes every time it is entered rather than a new column being entered. Thank you.

  4. #4
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: Add textbox value if new and provide date if it is overwriting value of old

    Sorry to bother you again, but it doesn't seem to work. Whenever I input the name it puts the date and when I put the same name in it adds a date in the next cell, which is good, but the first date is then changed as well, which is not what was intended. I cannot find what is wrong, can you?

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Add textbox value if new and provide date if it is overwriting value of old

    The code that I posted would not do that. Did you convert all your formulas in column B to values? What version of the code did you end up running?

  6. #6
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: Add textbox value if new and provide date if it is overwriting value of old

    I converted them to the Date: m/d/yyyy. Here is the code I used

    Please Login or Register  to view this content.
    The only thing I changed the Columns.Count to 2.

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Add textbox value if new and provide date if it is overwriting value of old

    Only write one date if the value exists - maybe this will be clearer, instead of using offset
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: Add textbox value if new and provide date if it is overwriting value of old

    That makes more sense, thank you.

+ 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] Use autocomplete to provide suggestions in a textbox
    By Templemind in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2014, 02:07 AM
  2. Provide 3 different results based upon date differences
    By InterstateRentals in forum Excel General
    Replies: 4
    Last Post: 02-07-2014, 10:15 PM
  3. if a date is within a range, provide specified text
    By qmarissa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-13-2013, 10:19 PM
  4. Textbox overwriting formula in cell
    By DurinsBane in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-07-2007, 10:26 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