Delete sheets - all except 3
One more...
Dim wks As Worksheet
Application.DisplayAlerts = False
For Each wks In ActiveWorkbook.Worksheets
select case lcase(wks.name)
case is = "welcome", "importedrawdata","importeddataedit"
'do nothing
case else
wks.delete
end select
next wks
Application.DisplaAlerts = True
Since the "select case" is looking for lower case characters (lcase), make sure
you type those strings in lower case.
joecrabtree wrote:
To all,
I have a workbook with many sheets, and wish to delete all of them
apart from the following 3:
WELCOME, ImportedRawData, + ImportedDataEdit
How can I do this?
Thanks very much for your help in advance,
Regards
Joseph Crabtree
--
Dave Peterson
|