LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Delete worksheets and the code sheets remain?



I used the following code to delete all the sheets except Sheets("Dummy").
It does this successfully for about 10 of the sheets, but there are 5 other
sheets whose actual WorkSheets ARE deleted but their CODE sheets remain.
What I see in the VBAProject window BEFORE deletion is "Sheet1( sheetxyz)"
and then AFTER the deletion I see "Sheet1". Only one of the code sheets
actually contained code.

Any ideas??





Dim wb As Workbook

Dim oSheet As Object

Set wb = ActiveWorkbook

For Each oSheet In wb.Sheets

If oSheet.Name < "Dummy" Then

Sheets(oSheet.Name).Select

ActiveWindow.SelectedSheets.Delete

End If

Next


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to delete sheets not in use based on a cell's drop down list kangasnat Excel Worksheet Functions 2 September 20th 07 03:08 AM
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM
Array Code to Delete Worksheets Volsfan Excel Programming 3 September 14th 05 04:42 PM
Delete text while numbers remain intact Sugar_grrl Excel Worksheet Functions 2 August 15th 05 05:32 PM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:11 PM


All times are GMT +1. The time now is 05:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"