+ Reply to Thread
Results 1 to 19 of 19

Insert Todays Date in cell when formula result changes

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Insert Todays Date in cell when formula result changes

    Good morning,
    I have a formula in cell M19.

    When entries elsewhere in the sheet cause the value calculated by the formula to change I would like to insert the date in cell M21.

    Thanks in advance for suggestions.

  2. #2
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Insert Todays Date in cell when formula result changes

    Hello

    Please Login or Register  to view this content.
    If I have solved your question, please mark the thread as [SOLVED],
    And consider adding reputation

    ?Simplicity is the ultimate sophistication? (Leonardo Da Vinci)

    Regards,
    F?bio Gatti

    https://www.youtube.com/pulodogatti
    https://www.linkedin.com/in/fabiocgatti/
    https://instagram.com/pulodogatti

  3. #3
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Dear fpt264


    This might be a good solution!

    Greetings Pan314


    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    Thanks for the replies but neither one works.

    To be clear, cell M19 contains a formula the result of which is dependent on entries made elsewhere in the sheet. If an entry causes the value in M19 to change I want the date in M21 to update to the current date.

  5. #5
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Hi!

    It works for me.
    I will send the sample file.
    If you have questions, you send a post.

    Pan314

  6. #6
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    Hi,
    I tried it again and it does insert the current date in M21 however Excel then proceeds to crash and restart to the previously saved file. I have no idea why. I've tried it several times. I'm using Excel 2016.

    I'm curious, what purpose does the "Range("M20000").Value " serve?

    Thanks for your interest.

  7. #7
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Hi fpt264

    The file I sent you, did not it work? Not at all or wrongly? I do not understand.
    I have a 2007 version. You also should work with it. Send own files to me (not real data and formulas will be good). Today it is not certain that I'll have time to deal with it.

    Pan314

  8. #8
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    Hi Pan314
    Yes your file works fine. I copy and paste the code in my file and after I make an entry that causes M19 to change the date and time appear in M21 then Excel crashes and closes without saving changes. I'll see if I can make a small test file to show you. No hurry. Thanks for your interest.

  9. #9
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Postscript: M20000 includes the value calculated for the last time in cell M19. (Any cell can be used instead of M20000)

  10. #10
    Valued Forum Contributor Gatti's Avatar
    Join Date
    06-08-2015
    Location
    Brasil, São Paulo, Ribeirão Preto
    MS-Off Ver
    365
    Posts
    346

    Re: Insert Todays Date in cell when formula result changes

    @fpt264

    By the way: you have to put this code in Worksheet VBA Page

  11. #11
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Insert Todays Date in cell when formula result changes

    Don't know exactly what's causing the error.
    You can store value internally using the macro below. Try if that works-
    Please Login or Register  to view this content.
    RIGHT CLICK ON SHEET NAME >> VIEW CODE >> PASTE THE ABOVE MACRO
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  12. #12
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Hi fpt264!

    I was on the wrong track. The winning Sourabh G98. His better. Press a button * Reputation him.
    Press the button * Reputation him!

    Good luck with VBA

    Pan314

  13. #13
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    sourabhg98,
    I tried your code but it is not working. I have attached a sample file. In this case when H14 changes the date should be recorded in H15. Thanks for your interest.




    Sheet1.xlsm

  14. #14
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Dear fpt264!

    Still, it's my solution looks good. The fact is that the formulas recalculate not cause Worksheet_Change event.
    Into the file named Sheet1-2 I copied my code. Now I am sending this to you as Sheet1-2. Works well. Try.
    Yesterday I was wrong regarding sourabhg98 solution.


    Pan314

    If that does not work with you again, it will be the big crossword puzzle.
    Attached Files Attached Files

  15. #15
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Insert Todays Date in cell when formula result changes

    oops, By mistake pasted the wrong macro--
    Try this one-
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    Pan314,
    Your latest version works fine, as does the one offered by sourabhg98. I have two sheets so I can evaluate them side by side and see if there is any advantage to one over the other. Thanks for all you help.

    fpt264

  17. #17
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    sourabhg98,
    Your latest version works fine, as does the one offered by Pan314. I will evaluate them side by side and see if there is any advantage to one over the other.

    I appreciate you help.

    fpt264

  18. #18
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Insert Todays Date in cell when formula result changes

    Hello fpt264!


    The first was my solution is the same. For some reason it did not work in your place.

    Sourabhg98 code is also good, even elegant, because the old value is stored as static variable. For this purpose, I used a cell awkwardly.

    Good for the future is worth noting the nature of static variables.

    Pan314

  19. #19
    Registered User
    Join Date
    08-13-2012
    Location
    Woodbury,CT
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2301 Build 16.0.16026.20002) 64-bit
    Posts
    67

    Re: Insert Todays Date in cell when formula result changes

    Hello Gatti,
    This is a belated thank you for your response to my post. It seems I initially overlooked your solution which at this point seems to be the best one. With the other suggestions the date was updated every time I opened the sheet, not just after
    entering a change.

+ 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. Autohide Columns that are < todays date and > todays date by 2 & 7 days
    By Dropfiddy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 03:51 AM
  2. [SOLVED] Insert todays date but make sure it doesn't change
    By smash96 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2014, 04:16 AM
  3. [SOLVED] VBA Insert Formula Result Into Cell
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2014, 01:52 PM
  4. [SOLVED] Function/formula to compare and insert todays date or yesterdays date
    By TC922 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2013, 05:28 AM
  5. Automatically insert todays date as a month?
    By AllenMead in forum Excel General
    Replies: 3
    Last Post: 09-06-2010, 10:58 AM
  6. Insert/append todays date when workbook is open
    By evenings in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-29-2010, 10:00 AM
  7. Using VB to find a range based on todays date and todays date +30
    By Steve_al in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 09:31 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