avoid warning when removing sheet

  • Thread starter Thread starter Tijmen
  • Start date Start date
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
 
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
 
Back
Top