+ Reply to Thread
Results 1 to 6 of 6

Code only runs when a user hits "Save", not "Save As"

  1. #1
    Registered User
    Join Date
    08-04-2014
    Location
    MN
    MS-Off Ver
    2012
    Posts
    2

    Code only runs when a user hits "Save", not "Save As"

    My code is incredibly simple (below). All I want is to update cell D2 whenever someone saves the file (regardless of if they use save or save as). Currently, the code will work if I use save, but if I save as, then I need to go back into the code and hit enter or any key, and it will work again until I use save as again. This code is in the "ThisWorkbook" section.

    Please Login or Register  to view this content.

    In case it matters, D2 is a formula: =LastSaved() which is run off a different code in the Module area:

    Please Login or Register  to view this content.
    Last edited by alansidman; 08-04-2014 at 07:19 PM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Code only runs when a user hits "Save", not "Save As"

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Code only runs when a user hits "Save", not "Save As"

    Why not instead just

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    08-04-2014
    Location
    MN
    MS-Off Ver
    2012
    Posts
    2

    Re: Code only runs when a user hits "Save", not "Save As"

    Thank you shg. :-D

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Code only runs when a user hits "Save", not "Save As"

    Add this as your first line in your code

    Please Login or Register  to view this content.
    and see if that makes a difference.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Code only runs when a user hits "Save", not "Save As"

    You're welcome.

+ 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] Script to save to folder in "v:\dept2", confirm file saved, then delete from "v:\dept1"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 11:42 AM
  2. Create a Command Button to "Save As" and "Close" an Excel Workbook
    By thedunna in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-26-2013, 05:38 PM
  3. Code for button runs and causes "1004" error on Exit and Save
    By TreePapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2010, 02:02 PM
  4. Stopping the save function...until a user has clicked "save as".
    By ExcelToyney in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2010, 07:36 AM
  5. save and restore "Workbook Menu Bar" & "Cell" menus
    By Jeff Higgins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2005, 10:08 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