+ Reply to Thread
Results 1 to 3 of 3

Macro to delete itself

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2016
    Posts
    99

    Macro to delete itself

    Is it possible to use VBA to have a Macro delete itself once finished running?

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: Macro to delete itself

    Save the file as xlsx and it's gone

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Macro to delete itself

    Hi there,

    See if the code in the attached workbook does what you need. It contains two methods - one deletes just the routine itself, the other deletes the entire CodeModule which contains the routine.

    The first VBA CodeModule contains the following code:

    Please Login or Register  to view this content.

    The second VBA CodeModule contains the following code:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

+ 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] Macro to Delete Delete headings and 9 rows above from row 15 onwards
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2021, 12:06 AM
  2. Run Macro Automatically When delete row , changes cell,delete column
    By elevisse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2012, 07:42 AM
  3. Macro to delete certain columns and delete rows based on time in another column
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2012, 11:47 AM
  4. Replies: 2
    Last Post: 09-13-2005, 12:05 AM
  5. [SOLVED] Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2005, 08:12 PM
  6. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By bhawane in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 PM
  7. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 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