+ Reply to Thread
Results 1 to 12 of 12

Function not working automatically

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS Office Standard 2013
    Posts
    27

    Function not working automatically

    Hello everyone,

    I am using Excel Standard 2013 (15.0.5501.1000) MSO (15.0.5493.1000) 32-bit.

    I have set up an Excel function to place the date it's file was last saved into a cell on it's summary worksheet. If the user clicks Save, or Saves on file close, the next time that cell is viewed it should be showing the saved date, unfortunately it only updates when I double click the cell!

    The function and cell formula are below, can anyone tell me how to modify this to make it work automatically? (The workbook calculation option is already set to automatic!)

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


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


    I hope someone can help.

    Thanks very much.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,150

    Re: Function not working automatically

    Try


    Please Login or Register  to view this content.
    Right click on "Thisworkbook", "View Code" and copy/paste above

    Change highlighted as needed
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Function not working automatically

    Depending how often you want it to update you could add a formula to yours that will causes a refresh when the workbook calculates.

    =LastModified(NOW())

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    05-17-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS Office Standard 2013
    Posts
    27

    Re: Function not working automatically

    Thankyou John, but I need it to change whenever the file is saved not just on closing.
    I will keep your solution as a last resort.
    Thanks again.

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS Office Standard 2013
    Posts
    27

    Re: Function not working automatically

    Thanks Andy,
    It works same as my code does i.e. it doesn't update itself when file is saved, you have to force it by double clicking cell.
    Thanks again.

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Function not working automatically

    You could try adding this as the first line of the function:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Function not working automatically

    You could use the BeforeSave event. But you will need to kick off another routine that gets the date after the actual save. And doing so will mean the workbook would need saving again because you would have updated the cell showing the update.

    How accurate does the Save date/time have to be?

  8. #8
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Function not working automatically

    So I had this as my function:

    Please Login or Register  to view this content.
    And I also had this in the ThisWorkbook module:

    Please Login or Register  to view this content.
    That seems to update the cell when the file is saved but I'm on O365 and can't test in your version.

    WBD

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,150

    Re: Function not working automatically

    @WBD/Phil: WBD solution (post #8) works for me for I am sure it will work on all versions of Excel (at least those post my 2010!)

  10. #10
    Registered User
    Join Date
    05-17-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS Office Standard 2013
    Posts
    27

    Thumbs up Re: Function not working automatically

    Excellent WBD - spot on.
    Thankyou very much

  11. #11
    Registered User
    Join Date
    05-17-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    MS Office Standard 2013
    Posts
    27

    Re: Function not working automatically

    Thanks John - me too!

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Function not working automatically

    That will show when the file was previously saved. The actual saving does not happen until after the calculate.
    It will depend on the date format being used. So if only showing the information to the nearest day then it will appear accurate. If showing time as well it may not.

    When the workbook is saved and closed the information shown on re opening the workbook will be correct.

+ 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] continuing formulas down tables automatically, not working for me
    By jitterbug888 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-24-2019, 08:41 AM
  2. Custom function not working automatically
    By Naz555 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-24-2017, 02:03 AM
  3. [SOLVED] Workbook_Open() Not Working automatically
    By davidpierce in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2015, 09:33 PM
  4. Automatically working out 6 months
    By dean.grimshaw in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-08-2014, 09:20 AM
  5. [SOLVED] Code is not working automatically
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-17-2014, 12:49 AM
  6. Advanced Filter is working manually but not automatically
    By rwgrietveld in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2010, 08:54 AM
  7. automatically working formula
    By alex dihes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2009, 07:25 PM

Tags for this Thread

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