getting rid of the "confirm delete" dialogue box when deleting a s

B

Bernard

I have a workbook with thousands of sheets and want to use a macro to delete
selected sheets. Problem is the macro is stopped to "The selected sheet will
be permanently deleted, please confirm delete.............".
Can this dialogue box be turned off permanently?
thanks
Bernard.
 
S

Shane Devenshire

Hi,

I generally recommend you bracket the command that will cause the message to
display as follows

Application.DisplayAlert = False
' the delete sheet line
Application.DisplayAlert = False

the reason is that this suppresses most alert until the subroutine is
complete and if there are any other parts of your code that would generate an
alert if something was wrong you would not see it.
 
B

Bernard

Thanks for that. However it responds with "Run time Error '438'
Object doesn't support this property or method"

I am using Excel 2000.
Bernard.
 
D

Don Guillett

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.
 
G

Gord Dibben

Shane missed the syntax. Note the "s"

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True


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