deleting sheet: how to omit warning

  • Thread starter Thread starter Marco Braun
  • Start date Start date
M

Marco Braun

Hello there,

when I call sheets(xyz).delete to delete a sheet from a workbook I
get a warning at runtime asking if I am sure that I want that sheet
deleted. (I wouldn't have coded it that way if I didn't want it deleted :-))
My question: How do I omit this warning at runtime of my vba script?

thanks
Marco
 
Application.DisplayAlerts = False

....will turn off such warnings

Patrick Molloy
Microsoft Excel MVP
 
Use Application.DisplayAlerts = False

This will block all alerts until the macro ends so you may want to set it to
True after the delete.
 
Don't forget to turn it back on again at the end!
-----Original Message-----
Application.DisplayAlerts = False

....will turn off such warnings

Patrick Molloy
Microsoft Excel MVP
.
 
You might find the following example of some interest, I use it to
delete sheets that look like I have no further use for, but it will not
delete sheets that have event macros, which may have something
still of interest.

Delete Active Sheet if name begins with "sheet" (#DeleteThisSheet)
http://www.mvps.org/dmcritchie/excel/sheets.htm#DeleteThisSheet

Information on event macros on my event.htm page.
 
Back
Top