I have got the below macro to delete all worksheets in a workbook except few specified ones, but it shows type mismatch error on the line highlighted in bold. I am using excel 2010 version.
Code:Sub deleteshts () Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In ThisWorkbook.Worksheets If ws.Name <> "Sheet3" Or "Sheet8" Or "Sheet11" Or "Pivot" Then ws.Delete End If Next Application.DisplayAlerts = True End Sub




Reply With Quote
