Suppress Delete Sheet Warning

S

Scott

I'm setting Application.ScreenUpdating = False before deleting a "hidden"
sheet in my workbook. My problem is that the warning saying "Data may exist
...." that pop ups when the "Delete" command is issued, is forcing me to
click "Delete". Is there anyway to auto answer the "Delete" dialog button
and prevent the user from getting any visual warning of the delete?



CODE:

Sub RemoveSheetDateHelper()

Application.ScreenUpdating = False

Sheets("tmpSheet").Visible = True
Sheets("tmpSheet").Select
Range("A1").Select
ActiveWindow.SelectedSheets.Delete

Application.ScreenUpdating = True
End Sub
 
G

Gord Dibben

Sub RemoveSheetDateHelper()
With Application
.ScreenUpdating = False
.DisplayAlerts = False
Sheets("tmpSheet").Delete
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub

Note: you don't have to activate or unhide "tmpsheet" to delete it.


Gord Dibben MS Excel MVP
 

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