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: 9
Default Deleting all sheets except one

I have a workbook in which I need to delete all sheets except one
called "SummaryReport". I have tried using the following code

For z = 1 To xlBook.Worksheets.Count
If xlBook.Worksheets(z).Name < "SummaryReport" Then
xlBook.Worksheets(z).Delete
Next z

This is falling over (I presume because the count changes as sheets
are deleted). How can I do this?

Nirmal
 
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
Deleting sheets TK[_3_] Excel Programming 2 August 31st 05 06:02 AM
deleting sheets 2&3 doug53098 Excel Discussion (Misc queries) 2 July 7th 05 08:22 PM
Deleting Sheets Jordan[_3_] Excel Programming 4 February 13th 04 03:19 PM
Deleting sheets Gary Adamson[_2_] Excel Programming 2 October 30th 03 07:24 PM
deleting sheets david Excel Programming 2 July 31st 03 01:02 AM


All times are GMT +1. The time now is 02:00 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"