MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Programmatically deleting sheets

Posted by Adam T. Dickson on October 16, 2001 10:07 AM

I am attempting to programmatically delete sheets in Excel, after their data has been copied into another sheet. I am using the following simple code:

Application.CutCopyMode = False

This works just fine for deleting the sheet; the problem is, it brings up a dialog box asking if you're sure you want to delete the sheet. This means the user has to interact with the macro, and therefore cannot run unattended.

Does anyone know how to programmatically click the okay button (or make the dialog box not pop up at all?


Posted by Dan on October 16, 2001 10:54 AM

Try this code -

Application.DisplayAlerts = False
Application.DisplayAlerts = True