kill worksheets

  • Thread starter Thread starter portroe
  • Start date Start date
P

portroe

I want to 'delete' all my worksheets after performing some operations on
the data,

The following code does NOT work sucessfully apparently due to the fact
that deleting all worksheets ends the Workbook, ! (error message)

Sub killWorksheets()
Dim W As Worksheet
For Each W In Worksheets
Worksheets(W.Name).Delete
Next
End Sub


Any tips most welcome,

thanks
 
You must leave at least one worksheet in a workbook.

If you don't want the workbook, why not just close it without saving it

Activeworkbook.Close SaveChanges:=False

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top