Delete an Excel worksheet without a warning message
How to delete an Excel worksheet without a warning message using VBA
Sub Delete_Worksheet_Without_Warning_Message()
Application.DisplayAlerts = False 'disable alerts from being displayed
Worksheets("Sheet2").Delete 'delete a worksheet named Sheet2
Application.DisplayAlerts = True 'enable alerts to be displayed
Worksheets("Sheet2").Delete 'delete a worksheet named Sheet2
Application.DisplayAlerts = True 'enable alerts to be displayed
End Sub
OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
ADJUSTABLE PARAMETERS
Worksheet to Delete: Select the worksheet to be deleted by changing the worksheet name in the VBA code to any existing worksheet in the workbook.
Worksheet to Delete: Select the worksheet to be deleted by changing the worksheet name in the VBA code to any existing worksheet in the workbook.
ADDITIONAL NOTES
Note 1: You can also replace the Worksheets with a Sheets object in the VBA code to also capture chart sheets.
EXPLANATION
This tutorial explains and provides step by step instructions on how to delete a single worksheet without a warning message using VBA.
This tutorial explains and provides step by step instructions on how to delete a single worksheet without a warning message using VBA.
VBA Methods: Using VBA you can delete a worksheet without a warning message by disabling display alerts when running the VBA code.