+ Reply to Thread
Results 1 to 11 of 11

How to record changes to cell values including time stamp

  1. #1
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    How to record changes to cell values including time stamp

    I have three columns in worksheet 1 (columns F, G, and H) that I want to record all changes to. If any value changes in those columns, I want it to record the previous value, the new value, and the time stamp it was changed. These recorded values/time stamps would be put into worksheet 2 (in columns B, C, and D respectively). The original values in worksheet 1 are alligned to a particular name (per row), so in column A on worksheet 2, it should say which name changed.

    Hopefully this make sense. Any help would be much appreciated. Thanks.
    Last edited by bigmantitus; 09-18-2012 at 10:23 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How to record changes to cell values including time stamp

    Right click on the sheet for the changes >> view code and paste this code on the right side of the screen

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    Jeff,

    Thank you very much for the quick reply. The code does not seem to do anything. I put the code into the worksheet that I am working from, and changed the With Sheets("Sheet2") to be the worksheet I want the data in. Any thoughts?
    Last edited by bigmantitus; 09-14-2012 at 03:49 PM.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How to record changes to cell values including time stamp

    See if this example helps
    Attached Files Attached Files
    Last edited by jeffreybrown; 09-17-2012 at 09:40 PM.

  5. #5
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    I was able to get it to work. The problem I had was because I already had a Private Sub Worksheet_Change. When I put yours in I changed the name but it would not run. When I added it to my existing Sub it ran. A few follow up questions:

    Is there a way to rename it so that it does not have to be part of my existing sub? It is impacting the way my other Sub works. Whenever I change the name it doesnt run.

    To add to the existing code, I would like to include the name of the change in column E on Sheet2. The names of the values from Sheet1 are Status, Target, Range (columns F, G, and H respectively). So for example, if a value in Sheet1 changes in column F, it would provide the information the Sub already does but also put "Status" in the appropriate row in column E.

    Thanks.

  6. #6
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    Any thoughts?

  7. #7
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    Jeff - I have attached an example. What your sub did was perfect, I just also want it to include the heading for that column (F2, G2, or H2) when the value in that column changes.

    As far as the code, you can see in the sub that I already have code that pops up a confirmation box when a value is changed in columns F:H. The issue I am having is that when I insert your code into mine, the 2nd sub (Private Sub Worksheet_SelectionChange) does not seem to run and therefore the option of "No" when asked to change does not work right (it makes the cell blank instead of putting the old value back in).
    Attached Files Attached Files

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How to record changes to cell values including time stamp

    Does this work as you require? Attachment in post #4 updated.

  9. #9
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    Jeff - thanks for the update. It seems to work correctly with only one issue. After the confirmation box pops up on a change, if you press No, it still changes the value (rather than revert back to the previous value).

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: How to record changes to cell values including time stamp

    Sorry my fault, should have checked the "No" side.

    In the code find...
    Please Login or Register  to view this content.
    ...and change it to
    Please Login or Register  to view this content.
    Just reverse positions.

  11. #11
    Registered User
    Join Date
    09-14-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    66

    Re: How to record changes to cell values including time stamp

    That seems to work perfectly. I will play with it and see what happens.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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