Delete a worksheet in a macro without having to see the "This worksheet will be permanently deleted"

 

Past Tip of the Day

 

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

By Bill Jelen on 23-Oct-2001
MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data.

MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.