+ Reply to Thread
Results 1 to 7 of 7

Run a Macro on Worksheet close?

  1. #1
    Registered User
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    79

    Run a Macro on Worksheet close?

    How can I adjust this code so it runs everytime the workbook is closed?

    Please Login or Register  to view this content.
    Thanks in advance

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Run a Macro on Worksheet close?

    You can have a Code to run just before the workbook is closed..

    Put this on your Workbook Module

    Please Login or Register  to view this content.
    https://msdn.microsoft.com/en-us/lib.../ff194765.aspx
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Run a Macro on Worksheet close?

    Thanks, but I don't think I've done it correctly? Any advice?
    Capture.JPG

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Run a Macro on Worksheet close?

    Double click on ThisWorkbook and paste the code there..

    Be sure that your Macros are enabled..

  5. #5
    Registered User
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Run a Macro on Worksheet close?

    Thanks NeedforExcel I've just been looking at your site, looks very intuitive. When I have some spare time I'll be back to purchase a course from you.

    I've bookmarked your site and will return soon.

    Your guidance is appreciated.

  6. #6
    Registered User
    Join Date
    04-27-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Run a Macro on Worksheet close?

    One last question....

    If i want it to run upon workbookopen, what would I change this too?

    Please Login or Register  to view this content.

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Run a Macro on Worksheet close?

    Here

    Please Login or Register  to view this content.
    And thank you for your kind words.. I am in the process of updating the Website..
    Last edited by NeedForExcel; 06-23-2015 at 05:41 AM.

+ 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. Be able to Close WorkSheet, but Not Form
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-20-2015, 06:14 PM
  2. Close Workbook,Rename Worksheet, Delete Worksheet.
    By Ariff_Chowdhury in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2013, 09:21 PM
  3. Sub Fires on Worksheet Close
    By germ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-21-2010, 02:31 PM
  4. [SOLVED] Worksheet close event?
    By has ex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2005, 07:07 PM
  5. Worksheet close event++?
    By has ex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2005, 07:07 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