Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Delete All Worksheets Apart From Some With Particular Name

How would I delete all Worksheets in a Workbook except those called "HOME",
"ONE" and "TWO" (for example).

Thanks!
Dave
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Delete All Worksheets Apart From Some With Particular Name

Sub DeleteSheets()
Dim sht As Worksheet
Application.ScreenUpdating = False

For Each sht In Worksheets
If sht.Name < "HOME" Then
If sht.Name < "ONE" Then
If sht.Name < "TWO" Then
Application.DisplayAlerts = False
sht.Delete
Application.DisplayAlerts = True
End If
End If
End If
Next sht

Application.ScreenUpdating = True
End Sub

---
HTH,
JP

On Oct 30, 7:45 pm, Dave wrote:
How would I delete all Worksheets in a Workbook except those called "HOME",
"ONE" and "TWO" (for example).

Thanks!
Dave



Reply
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
I can't delete my worksheets Dillon Excel Discussion (Misc queries) 1 March 5th 07 06:10 PM
Add or Delete Rows in Protected worksheets NH Excel Discussion (Misc queries) 0 March 16th 06 05:15 PM
How can I delete a row from all worksheets in a workbook easily? Tom Excel Worksheet Functions 1 March 9th 06 02:19 PM
not delete worksheets from names in a range DARREN FONG Excel Discussion (Misc queries) 3 November 11th 05 05:31 PM
delete rows from multiple worksheets dckrause Excel Worksheet Functions 1 June 1st 05 03:24 AM


All times are GMT +1. The time now is 05:29 PM.

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"