+ Reply to Thread
Results 1 to 8 of 8

Function to run when Workbook opens

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Function to run when Workbook opens

    Hi all!

    I need this function to work (to display the date/time sheet was last saved) everytime I open the Workbook.
    The function works but only after I go to the cell where it is located and hit enter.

    Please Login or Register  to view this content.
    Thanks for any assistance.

  2. #2
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Function to run when Workbook opens

    put this is the "ThisWorkbook" code sheet.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Function to run when Workbook opens

    Thanks very much.

  4. #4
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Function to run when Workbook opens

    Sorry not to get back to you sooner ... been out of town.
    I right-clicked on ThisWorkbook and inserted a module end entered the code.
    The LastSavedTimeStamp does not update until I go to the cell listing the function and hit enter.
    I have made a slight change to the sheet and saved it. Closed the workbook and reopened it. Still no luck for the function to run automatically.
    Any other ideas? Thanks!

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Function to run when Workbook opens

    try using a range instead, like so

    Please Login or Register  to view this content.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Function to run when Workbook opens

    Hi,

    You could simply make the function volatile
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  7. #7
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Function to run when Workbook opens

    Thanks again.
    Using the Range worked, but not exactly like you did it with the ".Formula".
    Rather:
    Please Login or Register  to view this content.
    Couldn't have done it without you, I am grateful. I'm sure this will help others also.
    Have a good day!

  8. #8
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Panama City, FL
    MS-Off Ver
    Excel 2016
    Posts
    175

    Re: Function to run when Workbook opens

    Thanks Don. The "Range" made it work so I won't need to use Volatile.

+ 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] Loop through workbooks and print one worksheet - workbook opens but not as active workbook
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2017, 06:26 AM
  2. Replies: 1
    Last Post: 01-13-2016, 06:06 PM
  3. how can i execute a macro in current workbook after another workbook opens?
    By sds1126 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2014, 09:36 AM
  4. Replies: 3
    Last Post: 07-12-2014, 06:04 AM
  5. Replies: 1
    Last Post: 03-10-2014, 05:20 AM
  6. 2003 opens new sheet, 2010 opens new workbook
    By AllTheGearNoIdea in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2011, 10:29 AM
  7. [SOLVED] Personal workbook opens when Excel opens
    By SheriTingle in forum Excel General
    Replies: 3
    Last Post: 03-29-2005, 08:06 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