A better way would be for you to alter the code name of the sheets you want to retain. Perhaps add a prefix to those sheets.![]()
Sub deletesheets() For j = Sheets.Count to 1 step -1 If ucase(left(Sheets(j).Name,5)) = "SHEET" then Sheets(j).Delete Next End Sub
The loop and check the codename rather than name before deleting.
You can change the code name of sheet object within the VBE.
Bookmarks