Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Wilhelmutt
 
Posts: n/a
Default Help deleting worksheets

I have a spreadsheet that has a huge number of worksheets that need to be
deleted. I want to use a wildcard in the criteria as the sheet naming
convention is admin_user and there are 70 users. Hence I want to delete any
sheet that starts admin_. I have tried a wildcard in an "if" statement but it
does not work. Any help would be greatly appreciated.


  #2   Report Post  
Robin Hammond
 
Posts: n/a
Default

Try this. Back up your workbook first. You can't undo the deletions.

Sub RemoveAdminSheets()
Dim shTest As Worksheet

If MsgBox("Have you backed up this workbook?", vbYesNo) = vbNo Then Exit Sub
Application.DisplayAlerts = False

For Each shTest In Worksheets

If shTest.Name Like "admin_*" Then shTest.Delete

Next shTest
Application.DisplayAlerts = True
End Sub

Robin Hammond
www.enhanceddatasystems.com
"Wilhelmutt" wrote in message
...
I have a spreadsheet that has a huge number of worksheets that need to be
deleted. I want to use a wildcard in the criteria as the sheet naming
convention is admin_user and there are 70 users. Hence I want to delete
any
sheet that starts admin_. I have tried a wildcard in an "if" statement but
it
does not work. Any help would be greatly appreciated.




  #3   Report Post  
Wilhelmutt
 
Posts: n/a
Default

That works just fine! Thank you.
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
Count of Worksheets Terry Excel Discussion (Misc queries) 7 February 23rd 05 09:39 AM
How to protect and unprotect 30 worksheets in a file every month . Protect & Unprotect Several Worksheets Excel Worksheet Functions 4 January 10th 05 01:29 PM
Protect/unprotect all worksheets Janna Excel Worksheet Functions 2 January 7th 05 01:01 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM
Assigning Cells in worksheets to other data in other worksheets. David McRitchie Excel Discussion (Misc queries) 0 November 27th 04 06:15 PM


All times are GMT +1. The time now is 06:56 AM.

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

About Us

"It's about Microsoft Excel"