Delete a Sheet without dialog

K

Ken Loomis

I am using this to delete a worksheet:

Sheets("Replace Info").Delete

however, that causes a warning dialog box. How can I delete that worksheet
without a dialog box?
 
M

Mike Fogleman

Application.DisplayAlerts = False
Sheets("Replace Info").Delete
Application.DisplayAlerts = True

Mike F
 
G

Gord Dibben

Ken

Surround with

Application.DisplayAlerts = False

Sheets("Replace Info").Delete

Application.DisplayAlerts = True


Gord Dibben Excel MVP
 
J

Jim Thomlinson

Just to be safe you should probably add

Application.DisplayAlerts = False
on error resume next
Sheets("Replace Info").Delete
Application.DisplayAlerts = True

or add this line into an existing error handler if you have one
Application.DisplayAlerts = True

Otherwise if the delete fails then you never turn the alerts back on whcih
can be a bad thing...
 

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