+ Reply to Thread
Results 1 to 15 of 15

Adding date when editing (adding) information.

  1. #1
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Adding date when editing (adding) information.

    Hello!

    I'm a new member of this forum, so I hope I didn't messed up with the category for my issue.

    I have a request of making something I have no clue how to make work, or even if it's possible to make it work.
    Maybe it's a bit ambitious for even Excel, or maybe it's not so practical.

    What I need is:
    On my workplace we have employees who need to constantly add data to an Excel file. For instance:

    Task - Additional note - Date the work has been completed.

    What we want is to automatize the date. So everytime you edit an additional note, the date will automatically edit to "todays" date.

    Is this possible? If so, can someone be kind and provide me a solution? I myself thinking to just adding the date by using a shortcut (cntl+shift+;), but it's manually, and therefore not what I actual search for.

    Kind regards.
    Last edited by Zingo313; 06-03-2019 at 05:31 AM.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    Hi

    You can only do that with VBA.
    Please Login or Register  to view this content.
    The code says that when a cell in column C from C2, is modified (entered) the cell in column D in same row is updated with the today date.

    Note: I use Sheet1 to put the code.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Adding date when editing (adding) information.

    the above will change the date when the note is edited. However if the note is edited in the future as there is for example a spelling mistake, it will also change the date. this may or may not be what you want

  4. #4
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    You're literally an Excel God!!

    This is amazing! Thank you SO MUCH!

    I will play with it, and see if I can adjust it to my needs.

  5. #5
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    Quote Originally Posted by davsth View Post
    the above will change the date when the note is edited. However if the note is edited in the future as there is for example a spelling mistake, it will also change the date. this may or may not be what you want
    In this case a little modification
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    In that case, how will the final code look like?

    Edit: I think I figured it out now, seems to work as I wanted it to! I really appreciate the help!
    Last edited by Zingo313; 06-03-2019 at 05:49 AM.

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    The alternate code
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    According adding multiply dates to the sheet: No idea what I did wrong first time, but I figured that out too...
    Last edited by Zingo313; 06-03-2019 at 07:56 AM.

  9. #9
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    Hi
    You can use the similar code to do multiple actions under the only one Worksheet_Change event.

    See the code and the file (D as new and E as update date)
    Please Login or Register  to view this content.
    Note: The code is executed always any cell in sheet1 is edited.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    I used a more primitive method..

    I have this semi issue with macros. I am not super sharp in them, and I tried to work it out but I simply can't.

    The reason I wanted to make the dates automatically were for a control purpose. Right now I have this issue with locking cells that concern the dates, as it wont allow me to. (I get an error when I lock the cells with macro). So I made it half working. My plan was to make two sheets.

    First sheet, I have the method you showed me. So the dates are created on the sheet 1, then I retract them to sheet 2, and that sheet is locked and can't be edited.
    The issue with this, it's not a safe way, as you can just edit the dates in sheet 1, and the idea kind of disappear with what I want. I thought about hiding the columns in sheet 1, but it's still not the most optimal way to do it.

    edit: Forsøg 2.0, is probably my best option I can provide myself.
    Attached Files Attached Files
    Last edited by Zingo313; 06-04-2019 at 04:35 AM.

  11. #11
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    I might have accomplished what I wanted now.. The only minor issue that might occur, is when you edit a field by accident, and therefore you add a date you didn't wanted.

    Although I think this is very close to what I wanted.

    Once again, I truly appreciate the help I got. Thank you so much!
    Attached Files Attached Files

  12. #12
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    Hi


    The following code allows you to forget the 'Dato' sheet

    The cells of the J: M columns were protected (Format, format cells protection, check box protect). The A: I cells were deprotected.

    The 'Faktura' sheet was protected with the password '123'. Feel free to change, , but also change the code so that VBA has the ability to unprotected the sheet.
    I also protected the VBA project with the same password (but you can choose a different one) - View Project explorer, under Microsoft Excel Objects, right click and choose VBAProject Properties.
    See the code and the file
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Adding date when editing (adding) information.

    I @Zingo313

    Only now I've seen your posts #11 and #12.

    Using the 'EnableSelection' sheet property is a good method, but you need to protect ProjectVBA. I do not know the password, but I was able to access the property and change it.

    Quem porfia sempre alcança === 'Those who strive always reach out'
    Have a nice day.

  14. #14
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    That makes sense. I will look up a guide to how to lock the codes. You're awesome! Thanks again.

  15. #15
    Registered User
    Join Date
    06-03-2019
    Location
    Copenhagen
    MS-Off Ver
    2007
    Posts
    8

    Re: Adding date when editing (adding) information.

    Quote Originally Posted by José Augusto View Post
    Hi


    The following code allows you to forget the 'Dato' sheet

    The cells of the J: M columns were protected (Format, format cells protection, check box protect). The A: I cells were deprotected.

    The 'Faktura' sheet was protected with the password '123'. Feel free to change, , but also change the code so that VBA has the ability to unprotected the sheet.
    I also protected the VBA project with the same password (but you can choose a different one) - View Project explorer, under Microsoft Excel Objects, right click and choose VBAProject Properties.
    See the code and the file
    Please Login or Register  to view this content.
    This is so good... but how are you able to "erase" the dates again? I can't figure it out. If I delete the field, the date remain.

+ 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] Editing existing formula, adding criteria
    By vill in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-22-2018, 11:33 AM
  2. Need help editing a macro and adding some things
    By lantros79 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-04-2017, 06:23 PM
  3. Help with adding and editing records in a database
    By chillingsince94 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-30-2016, 05:09 AM
  4. Replies: 5
    Last Post: 12-10-2014, 07:03 PM
  5. Replies: 4
    Last Post: 04-22-2012, 07:55 AM
  6. Update A Record In Access. Not Adding But Editing
    By internacio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2006, 11:40 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