Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Newbie80
 
Posts: n/a
Default need help, want to remove some sheets


Hi, I have some sheets that starts with the same substring and I want
all of them to be removed is there a simpel solution to this?

e.g
Thisworkbook.sheets("name-yyyy").delete exact match
The year differs so would like to remove all sheets that starts with:
Thisworkbook.sheets("name-").delete (multi delete if poss)


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=393860

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

For Each sh In ThisWorkbook.Worksheets
If Left(sh.Name,5) = "name-" Then
if ThisWorkbook.Sheets.Count < 0 Then
Application.DisplayAlerts = false
sh.delete
Application.DisplayAlerts = True
End If
End If
Next sh

--
HTH

Bob Phillips

"Newbie80" wrote in
message ...

Hi, I have some sheets that starts with the same substring and I want
all of them to be removed is there a simpel solution to this?

e.g
Thisworkbook.sheets("name-yyyy").delete exact match
The year differs so would like to remove all sheets that starts with:
Thisworkbook.sheets("name-").delete (multi delete if poss)


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile:

http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=393860



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
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard Excel Discussion (Misc queries) 2 August 4th 05 04:30 PM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta Excel Discussion (Misc queries) 14 March 16th 05 04:41 PM
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) RICHARD Excel Worksheet Functions 1 March 15th 05 05:49 PM
Sheets Skip Macro NICK Excel Discussion (Misc queries) 2 February 11th 05 07:16 AM
Multiple sheets selected twa14 Excel Discussion (Misc queries) 2 December 21st 04 11:15 AM


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