using VBA how can I delete a worksheet w/o the warning message pop

J

Jim K.

using VBA how can I delete a worksheet without having the warning message
popup "Data may exist in the sheet(s) ..."? I'm using
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
 
F

FSt1

hi
Application.DisplayAlerts = False
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
application.DisplayAlerts = True


Regards
FSt1
 
K

Kevin B

Insert the following command before the delete

Application.DisplayAlerts = False

Then at the end

Application.DisplayAlerts = True


Although display alerts comes back on automatically I always include the
line to turn it back on. Who know, MS might decide some day that you need to
do it, and if that happens my code will already be up to date.
 

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