Hello Andym,
Sub test()
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Sheets
If ws.Name < "Sheet1" Then ws.Delete
Next ws
Application.DisplayAlerts = True
End Sub
You can also replace Thisworkbook with ActiveWorkbook or
Workbooks("Book1.xls") depending on what workbook does the sheets you want
to delete are located.
Regards,
Jon-jon
"andym" wrote in message
...
Can you tell me how to write code to delete all worksheets other than
those with a pre-specified name. eg all sheets other than Sheet1
Thanks
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/