Deleting worksheets in a macro

D

Donna

I have a macro that at the end there are 2 work sheets that I delete.
When the macro runs, it stops and asks if I really want to delete the
worksheets. Is there something I can add so that it will not ask me if I
want to delete?
Here is what I have.

Sheets("Sheet3").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Delete
Thanks Donna
 
J

Jacob Skaria

Further you dont need to select the sheets; instead you could try

Application.DisplayAlerts = False
Worksheets(Array("Sheet2","Sheet3")).Delete
Application.DisplayAlerts = True
 

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