Deleting a sheet with VBA

H

hamishd

Hi, i'm using the line:
Sheets("Sheet2").Delete

However, on execution, I get a warning messagebox:
"Data may exist in the sheet(s) selected for deletion. To permanently
delete the data, press Delete."

How do I suppress messages of these types?

Thanks.
 
G

Gary Keramidas

and if you set it to false, make sure you always set it back to true

Application.DisplayAlerts = False
Sheets("Sheet2").Delete
Application.DisplayAlerts = True
 
R

RadarEye

Hi,

Try:

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

HTH,

Wouter
 

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