Are there any sheets to the left of the summary sheet
Sub daveyc18()
Dim i As Long
Application.DisplayAlerts = False
For i = Sheets("Summary").Index + 1 To Sheets.Count
Sheets(i).Delete
Next i
Application.DisplayAlerts = True
End Sub
Sub dsheet()
Application.DisplayAlerts = False
Dim i As Integer
For i = Sheets.Count To Sheets("Summary").Index + 1 Step -1
Sheets(i).Delete
Next i
Application.DisplayAlerts = True
End Sub
You need to delete backwards from the last sheet to the Summary sheet since after you delete a sheet, the Sheets.Count will get throw off and going forward it won't delete that last sheet. Try this:
Code:Sub dsheet() Application.DisplayAlerts = False Dim i As Integer For i = Sheets.Count To Sheets("Summary").Index + 1 Step -1 Sheets(i).Delete Next i Application.DisplayAlerts = True End Sub