Delete a Worksheet in a Macro Without Delete Confirmation


October 23, 2001 - by

Charlie asks:

Is there a way in VBA to remove a worksheet which will bypass the "The selected sheets will be permanently deleted. Click OK" prompt?

This particular message is one that can be suppressed by using the Application.DisplayAlerts property.

Use the following code:

Application.DisplayAlerts = False
Worksheets("MySheet").Delete
Application.DisplayAlerts = True