Confirm deletion

  • Thread starter Thread starter dsan
  • Start date Start date
D

dsan

Worksheets(1).Select
ActiveWindow.SelectedSheets.Delete

When deleting a sheet from my workbook using the above code I am asked
to confirm that I really want to do this. How can I force the macro to
delete without requiring confirmation?
 
Hi

Simplify. Dont select and use their windows. Just delete Worksheets(1).

What you look for is DisplayAlerts, set it to False and it means "I know
what I'm doing so don't interrupt". Like this:

Sub Killit()
Application.DisplayAlerts = False
Worksheets(1).Delete
Application.DisplayAlerts = True
End Sub
 

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

Back
Top