+ Reply to Thread
Results 1 to 18 of 18

Timestamp each time a cell value changes

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Timestamp each time a cell value changes

    Is there a way to make a time stamp (date, minutes, seconds) when a cell value is changed? And that's a "cell value" that is determined by a formula.


    It can be like this:
    ------------------------------
    A1 Formula with value
    A2 Timestamp here, every time the value changes.


    Thanks!

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Timestamp each time a cell value changes

    No, you could only do that with vba.

    A formula timestamp would change every time recalculation occurs, even if the precedent cell is unchanged.

  3. #3
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    Ok. I don't know what "vba" is... but can you help me with that so I can try it out?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Timestamp each time a cell value changes

    One way would be the following Sheet Change macro

    Please Login or Register  to view this content.
    Quote Originally Posted by nenadmail View Post
    Ok. I don't know what "vba" is... but can you help me with that so I can try it out?

    Hi,

    Right click on the sheet name and choose 'View Code'
    In the right hand pane select 'Worksheet' from the left hand drop down.
    Select 'Change' in the right hand drop down.

    Paste the code I gave you (less the Sub Worksheet_Change and End Sub first and end lines since the drop downs automatically give you these) between the two lines of code.

    Regards
    Last edited by Richard Buttrey; 07-28-2012 at 05:57 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    Ok this works when i type something directly into cell A1.... or when the formula is SUM...
    For some reason it's not working for the cell formula I'm using.

    =IF('Annual Items'!R5=0;"";'Annual Items'!R5)

    But if the code can be adjusted to reflect (WHEN it's BLANK "" and When it's filled with a value) then do a timestamp... that will work for me!


    BY THE WAY... Obviously this is not for just "A1" only, but all cells from (A6 through A260). And the resulting timestamp needs to be (E6 through E260) one timestamp in each corresponding row.... thanks!
    Last edited by nenadmail; 07-28-2012 at 05:59 PM.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Timestamp each time a cell value changes

    Hi,

    It's not 'obvious' this is not just for A1. Your OP was quite specific. The code I gave you assumes the formula in A1 changes because one of its precedent cells changes.

    Rather than waste our time you should be quite specific with your request in the first place. We're not psychic.

    Try changing the A1 ref to A6:A260 and A2 to E6:E260

  7. #7
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    1. Sorry... I'm not purposefully trying to waste anyone's time, including mine. On the contrary, I tried asking for as little as possible, because I planned to edit the rest of the code myself. I figured that part would be easy for me to do. Before you even suggested it, I adjusted "A1" to be "A6:A260" (That's all I know about coding)... BUT it's not working that way. It only works for one cell at a time... Is there another way to code that in there?

    2. Also, as I mentioned before.... what about the "value" of the cell changing from being "" BLANK.... to not being blank.

    ---------- Post added at 05:23 PM ---------- Previous post was at 05:21 PM ----------

    Here's what I did to the code.....
    Please Login or Register  to view this content.
    Thanks for your patience!!!

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Timestamp each time a cell value changes

    Hi,

    I'm assuming that A6:A250 contain formulae, which when they change because a precedent cell changes cause the column E cell to be date stamped

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    Ok... Almost there... Now it does a timestamp when Column A has a regular formula like =SUM(B6:D6) and value changes... or when i type something in manually.
    However, it still DOES NOT do a timestamp with the formula I use now. Which make Col A either be "" BLANK or "FILLED"... (Example of cell A formula... =IF(B6=0;"";B6)

    So, perhaps something in the code to search for the condition: WHEN cell is A = "" BLANK then timestamp... AND WHEN cell A = "FILLED WITH A VALUE" also timestamp....
    If that can work, then it will be perfect! Thanks again!!!!

  10. #10
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    By the way... an error also pops up with the macro. And when I click on "Debug" it highlights this reference in yellow:
    Please Login or Register  to view this content.
    And I know that piece of code is in there twice. The top one, or the first reference is highlighted. Thanks!

  11. #11
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: Timestamp each time a cell value changes

    By the way... an error also pops up with the macro. And when I click on "Debug" it highlights this reference in yellow:
    Please Login or Register  to view this content.
    And I know that piece of code is in there twice. The top one, or the first reference is highlighted. Thanks!

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Timestamp each time a cell value changes

    Quote Originally Posted by nenadmail View Post
    =IF('Annual Items'!R5=0;"";'Annual Items'!R5)
    Our solutions are only as good as your examples. The code is not being triggered because the target is in a different sheet.

    You would need to enter the code into the "Annual Items" code module and qualify the ranges with a reference to the sheet holding the timestamp.

    Once corrected this might work, I'm lost trying to figure out from your many different examples what you're working with.

    The method of coding required is specific to the content of the cell, as you're finding out, what is written for one scenario doesn't always work with another, in general, values need a change event, formula need calculate, but in your case to track specific formula changes, you need to look at changes in precedent cells (the cells that you change that will cause the formula to recalculate).

  13. #13
    Registered User
    Join Date
    06-20-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Timestamp each time a cell value changes

    Hi,

    This is my first time posting. For the code below, it records a new date stamp in row 2 and its respective column if a cell value in row 1 changes. How do I repeat it for row 5? Let say I have a second set of values on row 5 that I want to see a new date stamp on row 6 if values on row 5 changes.

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim V As Variant
    If Not Intersect(Target, Rows("1:1")) Is Nothing Then
    Application.EnableEvents = False
    For Each C In Intersect(Target, Rows("1:1"))
    Application.Undo
    V = C.Value
    Application.Undo
    If Not IsEmpty(C) And V <> C Then
    C.Offset(1, 0).Value = Now
    End If
    Next C
    Application.EnableEvents = True
    End If
    End Sub


    Thanks

  14. #14
    Registered User
    Join Date
    02-10-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    65

    Re: Timestamp each time a cell value changes

    Hi Richard,

    First time poster here. I've seen many users trying to timestamp when a cell value changes, and the timestamp VBA codes can do that *only* when the cell value is changed manually.

    Is there a way to alter the VBA code you've shared so that a timestamp will appear when Target Cell's value changes WHEN THE CHANGE IS THE RESULT OF A REFERENCE (i.e. =Sheet2!A1)?

    Thanks

  15. #15
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Timestamp each time a cell value changes

    Hi arwebb0264,

    It looks like, as a new member, that you may not be aware of the basic rules that all members are required to follow, please take a moment to read them (there is a link to them in the header at the top of this page).

  16. #16
    Registered User
    Join Date
    02-10-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    65

    Re: Timestamp each time a cell value changes

    Hi Jason,

    I don't understand - it seems as though you think I am cross-posting, but I am not. The problem I posted is actually the crux of nenadmail's issue, too.

    And the posters seem not to get that, so I was trying to rephrase reiterate. If I am mistaken, I apologize. Thanks!

  17. #17
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Timestamp each time a cell value changes

    Sorry, I should have been more specific, I was actually referring to rule #2,

    Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  18. #18
    Registered User
    Join Date
    02-10-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    65

    Re: Timestamp each time a cell value changes

    Oh okay, thanks for the heads-up.

+ 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