Hello Experts,
I have a code below to delete few unwanted sheets and keep the sheets where I have SMRY as a part of the sheet name. This code works fine if I put it in This Worksheet. I get runtime error if I put it in module and try to operate the code from there. Tried changing the name to Sub XXX still got the error.
From module it gets stuck at the line below
and the full code is
Sub Delete_Unwanted_Worksheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
Application.DisplayAlerts = False
If Not ws.Name Like ("*SMRY*") Then
ws.Delete
End If
Next
Application.DisplayAlerts = True
End Sub
Please advise. Best Regards/VKS
Bookmarks