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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top