What is the VBA code to delete a sheet without warning message?

S

slingsh0t

I have the following code to delete a tab:

Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete

When I run this, I get the standard "You may lose data" warning
message. Does a different syntax allow me to delete the sheet without
getting the warning message?

Thanks
 
D

Dennis

Application.DisplayAlerts = False
Sheets("Your Sheet").Delete
Application.DisplayAlerts = True

HTH Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top