+ Reply to Thread
Results 1 to 12 of 12

Create Timestamps each time there is an edit in a Textbox

  1. #1
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Create Timestamps each time there is an edit in a Textbox

    Hello all,

    Yes I know that my title for my thread is confusing, but please let me explain.

    I am trying to figure out if there is a way to create a timestamp in a textbox when the textbox first initializes in the userform, when an edit is made, and when subsequent edits are made without removing any of the prior timestamps.

    For example:

    4/19/2017: "Edit 1"
    4/20/2017: "Edit 2 would be made here while saving the prior edits and the timestamp that it was created at"
    4/21/2017: "Edit 3 would be made keep all prior notes to this note made"

    I am using this userform as a form of case management and it is imperative that I know when certain notes are added to my textbox. As an additional requirement I would like the data that is entered into the textbox from prior edits to be locked. More specifically, I do not want other users to be able to alter the notes that were previously entered into the textbox.

    Any guidance or direction is greatly appreciated!

    Thanks!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Create Timestamps each time there is an edit in a Textbox

    I would suggest you have two textboxes. One to hold all the entries with time stamps (locked). The second to create the entries that will be added to the first textbox.

    In the example code below, TextBox1 is the list of notes. Textbox2 is where you make the note entries.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Create Timestamps each time there is an edit in a Textbox

    EDIT - oops! - in error I included a date stamp instead of a time stamp - so in the code below in Private Sub cb_update_Click()
    replace:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    ---------------------------------------------------------------------

    Try this
    - also employs 2 text boxes
    - old text retained in a hidden worksheet
    - sheet can only be made visible with VBA
    - you may want to employ better protection after testing

    see attached workbook

    you can unhide/hide the sheet with shortcut {CTRL} t which runs this VBA
    Please Login or Register  to view this content.
    Sheet is automatically hidden upon save and open with:
    Please Login or Register  to view this content.
    below is userform VBA:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 04-20-2017 at 08:50 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Re: Create Timestamps each time there is an edit in a Textbox

    Wow. This solution is great. Thank you both for the help. I am looking to keep textbox edits by row. My form is currently made to create multiple entries and I only want updates on the textbox made for the entry that it corresponds too. Currently with the formula you provided it is copying all of the notes entered for every entry. Is there anyway to get around this?

  5. #5
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Re: Create Timestamps each time there is an edit in a Textbox

    Logically thinking I am just trying to think of a solution. If I set a reference number to the entries, will it be able to pull any notes associated to the textbox and fill the notes with the matched reference number, regardless of position?

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Create Timestamps each time there is an edit in a Textbox

    I do not understand what you are trying to do.
    What do you want to retain a record of - I thought you wanted everything
    At the moment each edit is saved as a separate cell in the hidden sheet - do you want the user to be able to pull up the individual edits and be allowed to edit them?

    Some simple examples would help I think.
    5 entries to cover all possibilities. Please include the cumulative complete textbox after each entry

    Entry 1
    What is user adding?
    What is user editing?
    What does cumulative textbox show contain now?

    Entry 2
    What is user adding?
    What is user editing?
    What does cumulative textbox contain now?

    ...etc

  7. #7
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Re: Create Timestamps each time there is an edit in a Textbox

    Essentially my userform is a form of case management:

    User is notified of a case and access's form to put down all the information that they know.

    That information is saved on Sheet 1 beginning in row 4. Additional new entries are saved under them.

    The user adds notes to their initial entry and I would like them to be able to save them to a cumulative textbox which you demonstrated earlier.

    Following this, a user can learn additional information pertaining to the case. The user recalls their entry by selected the row number on the left and the userform is prepopulated with all the information listed on that row. I have also set cumulative note box to prefill based upon the information in Sheet 2 current row. Essentially I am only calling the information in that row and I need to replace the cumulative textbox with the new entries but by doing so I am deleting the previous entry. I was wondering if I need to add a 3rd column to get around this or if I should just think differently all together?

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Create Timestamps each time there is an edit in a Textbox

    I do not want a story - it only makes it more confusing
    I want to see what happens to the text boxes and to the excel sheet AT EACH STAGE
    Without a practical (fictitious) example I will be floundering in the dark.

    thanks

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Create Timestamps each time there is an edit in a Textbox

    Quote Originally Posted by Adangelo View Post
    Essentially I am only calling the information in that row and I need to replace the cumulative textbox with the new entries but by doing so I am deleting the previous entry. I was wondering if I need to add a 3rd column to get around this or if I should just think differently all together?

    Do you just want to concatenate the textbox text to the end of existing text in a cell? If yes, somethining like this should work...

    Range("A1").Value = Range("A1").Value & vbLF & TextBox1.Text

  10. #10
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Re: Create Timestamps each time there is an edit in a Textbox

    AlphaFrog, yes essentially that's what I want to do. I want textbox1 to equal the new notes that have just been inputted by a user and textbox 2 to be a locked textbox that shows all previous notes for the same entry which will add the new notes after pushing the submit button.

    So after pressing submit textbox 1's notes will be moved into textbox 2 but textbox 2 will have all previous entries and textbox 1's notes added to the end.

  11. #11
    Registered User
    Join Date
    04-14-2017
    Location
    Chicago, IL, USA
    MS-Off Ver
    2013
    Posts
    30

    Re: Create Timestamps each time there is an edit in a Textbox

    AlphaFrog, I did your solution and it ended up working. Thank you both for your help!

  12. #12
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Create Timestamps each time there is an edit in a Textbox

    I am very glad that you have a solution.
    Thanks for the reps

+ 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] Calculate Blocks of Time from Non-continuous Timestamps
    By GeoffH1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-31-2016, 02:13 PM
  2. Time calculations - trying to work with multiple timestamps
    By JillJ in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2014, 07:40 AM
  3. [SOLVED] Macro Create an automatic History Sheet with timestamps
    By leander in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2013, 09:52 AM
  4. create continueous log with timestamps
    By kim2far in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2013, 09:07 AM
  5. Time between timestamps excluding certain hours
    By Silaswulff in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-01-2011, 06:08 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