VBA Bypass Delete Sheet Warning

G

Guest

Friends,

I have written VBA code that loops through 150 workbooks and performs
various tasks on each workbook. One task I need to perform is deleting one
sheet in each workbook.

Problem is, the Excel Delete Sheet Warning message box appears before each
deletion, which means I need to manually confirm the deletion 150 times. Is
there a VBA way to turn off Excel's delete sheet warning (like there is in
Access)?

Thanks for your help ...

bill morgan
 
G

Gary Keramidas

something like this

Sub delsheet()

Application.DisplayAlerts = False
Worksheets("sheet3").Delete
Application.DisplayAlerts = True
End Sub
 
G

Guest

application.displayalerts = false
sheets("Whatever").Delete
application.displayalerts = true
 
R

Ron de Bruin

Hi Bill

You can use this

Application.DisplayAlerts = False
'Code
Application.DisplayAlerts = True
 
D

davesexcel

Sub ..
Application.DisplayAlerts = False
'your code here ...
Application.DisplayAlerts = True
End Su
 
G

Guest

So simple! Thanks, Gary ...

Gary Keramidas said:
something like this

Sub delsheet()

Application.DisplayAlerts = False
Worksheets("sheet3").Delete
Application.DisplayAlerts = True
End Sub
 
G

Guest

Thanks, Dave. Glad I asked ... so simple, but would have taken me awhile to
figure out.
 

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