avoid warning when removing sheet

T

Tijmen

I want to remove all sheets except of sheet 1 by a macro

iSheetMax = Sheets.Count

' Delete other sheets
For iSheet = 2 To iSheetMax
Sheets(2 + iSheetMax - iSheet).Delete
Next

Then the user gets a warning message (warns for permanently deleting of
sheet).
I do not want this.

How can I prevent the warning message to appear?

Thanks,

Tijmen
 
S

Snake Plissken

like this I suppose:

iSheetMax = Sheets.Count

' Delete other sheets
application.DisplayAlerts =False
For iSheet = 2 To iSheetMax
Sheets(2 + iSheetMax - iSheet).Delete
Next
application.DisplayAlerts =true
 

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