JohnDouglas
Board Regular
- Joined
- Jan 5, 2005
- Messages
- 239
Hi guys
i have hte following line of code that deletes all sheets that aren't named "Main".
But, i'd like a couple of other sheets to not be deleted too. such as "Main 2" etc. Is it possible to adjust this code so that it won't delete any sheet named in an array or any sheet that contains "Main" in its name?
Thanks for your help
John
i have hte following line of code that deletes all sheets that aren't named "Main".
Code:
For I = ActiveWorkbook.Worksheets.Count To 1 Step -1
On Error Resume Next
If Worksheets(I).Name <> "Main" Then _
Worksheets(I).Delete
On Error Resume Next
Next I
But, i'd like a couple of other sheets to not be deleted too. such as "Main 2" etc. Is it possible to adjust this code so that it won't delete any sheet named in an array or any sheet that contains "Main" in its name?
Thanks for your help
John