Self-deleting macros are a handy tool to have in your Excel arsenal. They can be used to clean up unwanted data, remove old files, or simply make space on your hard drive. Here's how to create a self-deleting macro:
Sub DeleteMe()
On Error Resume Next
Kill "C:\path\to\file\you\want\deleted"
On Error GoTo 0
End Sub
Replace "C:\path\to\file\you\want\deleted" with the path of the file you want to delete. Make sure to use double backslashes (\\) instead of single backslashes (\) - otherwise, the macro won't work!