Macro Delete Sheet w/no "ok" box?

D

Dennis

I've coded the macro

Sub DeleteSheet()
ActiveWindow.SelectedSheets.Delete
End Sub

When I execute the macro I get the warning box "The Selected sheets will be
permanently deleted. Click Ok or Cancel"

How do you get rid of the warning box and just delete the sheet without a
warning?

I've tried

ActiveWindow.SelectedSheets.Delete (False) This created a compile error for
..Delete

Thanks in advance for any help.

Dennis
 
H

Harald Staff

Hi Dennis

Sub DeleteSheet()
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
End Sub

HTH. Best wishes Harald
 

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