macro to delete a sheet

M

MoiraGunn

I know this is an easy one but I need some help.
I'd like to delete a sheet in my macro but I keep getting a dialog box that
asks me if I'm sure I want to delete the sheet. I want to bypass this
automatically but don't know how. Any help is appreciated.
Example of the 2 lines I'm stuck on.

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

I'm using Excel 97.

Thanks Kathy
 
J

J.E. McGimpsey

one way:

Application.DisplayAlerts = False
Sheets("scratch").Delete
Application.DisplayAlerts = True

Note that you don't have to select the sheet first.
 
M

MoiraGunn

Excellent - this works! Thanks very much -

J.E. McGimpsey said:
one way:

Application.DisplayAlerts = False
Sheets("scratch").Delete
Application.DisplayAlerts = True

Note that you don't have to select the sheet first.
 

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