+ Reply to Thread
Results 1 to 8 of 8

Timestamp beneath target cell when target cell's value changes based on calculation.

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

    Arrow Timestamp beneath target cell when target cell's value changes based on calculation.

    Tracker_Pipeline_and_Accruals_04.14.2016.xlsx

    In the 3rd sheet ('Accrual!'), cells B11 and B23 contain boxes for totaling their respective charts.

    I am trying to write a VBA script that will simply timestamp [MM:DD:YY HH:MM:SS AM/PM] in B12 and B24 anytime their above cell's values change.

    I am having trouble with it because I don't want the timestamps to update anytime I open the WB, or anytime a change is made in other cells - I only want a timestamp in B12 when the value of B11 changes, or in B24 when B23 changes.

    I have done this before, but it took me about a week of grueling shots in the dark. If someone is willing to explain how their code works, I am definitely trying to become more independent.

    Thanks all in advance.
    Last edited by arwebb0264; 04-14-2016 at 02:36 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    There are a couple of ways to do this. One is to use Worksheet_Change to monitor for changes to the cell of interest. However, in your case that doesn't work because you are using a formula; the event fires only if the content of the cell changes, not the value it returns. Another way is to monitor changes to the cells that can cause your formula result to change, but there is a long chain to do that.

    So this method records the value in the cell, and every time anything in the file changes, it checks to see if that cell changed. It keeps track of prior values in a sheet called Track, which can be hidden if you prefer.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    Hi 6SJ,

    Thank you for the lookover and the explanation. I understand the differences between the options you mentioned.

    Out of curiosity- what happens if the Reset Values button in LastValue! is activated?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    It forces the saved values to be updated to the current values. This should not normally be needed but I put it in there just in case somehow things get out of sync and you need to clean it up.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    You can do it with a Worksheet Change event handler but, because in this case the cell of interest is a formula, it is necessary to monitor the cells's precedents, not the cell itself.

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    Note:

    Please Login or Register  to view this content.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    @6SJ: thanks for the rep

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Timestamp beneath target cell when target cell's value changes based on calculation.

    You are very welcome. The .Precedents solution is much tidier.

+ 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. Self Ajusting cell , moving to provide target to meet end of year target
    By andycuk7 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-15-2016, 11:22 AM
  2. VBA Timestamp only updates if Target cell is manually changed?
    By arwebb0264 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-12-2016, 04:58 PM
  3. Changing Formula based on what is in the target cell
    By 5upgraphics in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-02-2014, 05:54 PM
  4. Hide multiple rows below target cell based on a cell value match elsewhere.
    By tapmagoo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2013, 12:37 PM
  5. Replies: 5
    Last Post: 01-22-2013, 11:38 AM
  6. Worksheet_CHange (ByVal Target as Range) when target is formula cell
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2012, 07:00 PM
  7. Sheet calculation target cell
    By Otto Moehrbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2006, 03:15 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