macro-delete all sheets except
Mention the sheets not to be deleted in the string variable comma separated
without any spaces.. and try the macro
strSheet = "Sheet1,Sheet2"
Sub Macro()
Dim strSheet As String
strSheet = "Sheet1,Sheet2"
For Each sh In Worksheets
If InStr(1, "," & strSheet & ",", "," & sh.Name & ",", _
vbTextCompare) = 0 Then sh.Delete
Next
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"puiuluipui" wrote:
Hi, i need a macro to delete all sheets except 4 or 5 sheets.
Can this be done?
Thanks!
|