![]() |
kill worksheets
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 |
kill worksheets
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) "portroe" wrote in message ... 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 |
kill worksheets
yep i guess that makes sense
thanks Bob Phillips wrote: 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 |
All times are GMT +1. The time now is 02:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com