Search code examples
vbaexcelexcel-2010excel-2013

How do I automate the deletion of a worksheet?


I'm using Application.Sheets("Sheet6").Delete to delete a sheet, and it causes a popup that asks if I'm sure. How do I automatically select delete?


Solution

  • Update your code to disable the display of alerts before you delete your sheet; Then enable the alerts after the delete code executes

    Application.DisplayAlerts = False
    Sheets("Sheet6").Delete
    Application.DisplayAlerts = True