Macro to Delete all worksheets except Active sheet in Excel

Delete All Worksheets in a workbook, except Active sheet)

Sub DeleteSheets()
Dim XLnCAD As Worksheet
For Each XLnCAD In ThisWorkbook.Worksheets
If XLnCAD.Name <> ThisWorkbook.ActiveSheet.Name Then
Application.DisplayAlerts = False
Application.DisplayAlerts = True
End If
End Sub

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.