PC Review


Reply
Thread Tools Rate Thread

Delete Selected Worksheets Macro

 
 
Indianagreg
Guest
Posts: n/a
 
      31st Dec 2008
I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2),
FI (3), etc. I want to delete all tabs that start with FI.

I've tried the below without success - any suggestions? Here's what I have:

Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Worksheets
If ws.Name = "FI (*)" Then ws.Delete
Next
Application.DisplayAlerts = True

 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      31st Dec 2008
Sub FI_killer()
Application.DisplayAlerts = False
For Each w In Worksheets
If Left(w.Name, 2) = "FI" Then
w.Delete
End If
Next
Application.DisplayAlerts = True
End Sub

--
Gary''s Student - gsnu200822


"Indianagreg" wrote:

> I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2),
> FI (3), etc. I want to delete all tabs that start with FI.
>
> I've tried the below without success - any suggestions? Here's what I have:
>
> Dim ws As Worksheet
> Application.DisplayAlerts = False
> For Each ws In Worksheets
> If ws.Name = "FI (*)" Then ws.Delete
> Next
> Application.DisplayAlerts = True
>

 
Reply With Quote
 
 
 
 
Indianagreg
Guest
Posts: n/a
 
      31st Dec 2008
Perfect! Thank you and Happy New Year

"Gary''s Student" wrote:

> Sub FI_killer()
> Application.DisplayAlerts = False
> For Each w In Worksheets
> If Left(w.Name, 2) = "FI" Then
> w.Delete
> End If
> Next
> Application.DisplayAlerts = True
> End Sub
>
> --
> Gary''s Student - gsnu200822
>
>
> "Indianagreg" wrote:
>
> > I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2),
> > FI (3), etc. I want to delete all tabs that start with FI.
> >
> > I've tried the below without success - any suggestions? Here's what I have:
> >
> > Dim ws As Worksheet
> > Application.DisplayAlerts = False
> > For Each ws In Worksheets
> > If ws.Name = "FI (*)" Then ws.Delete
> > Next
> > Application.DisplayAlerts = True
> >

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      31st Dec 2008
You too!
--
Gary''s Student - gsnu200822


"Indianagreg" wrote:

> Perfect! Thank you and Happy New Year
>
> "Gary''s Student" wrote:
>
> > Sub FI_killer()
> > Application.DisplayAlerts = False
> > For Each w In Worksheets
> > If Left(w.Name, 2) = "FI" Then
> > w.Delete
> > End If
> > Next
> > Application.DisplayAlerts = True
> > End Sub
> >
> > --
> > Gary''s Student - gsnu200822
> >
> >
> > "Indianagreg" wrote:
> >
> > > I have a workbook with 500 tabs. 200 of the tabs are named: FI (1), FI (2),
> > > FI (3), etc. I want to delete all tabs that start with FI.
> > >
> > > I've tried the below without success - any suggestions? Here's what I have:
> > >
> > > Dim ws As Worksheet
> > > Application.DisplayAlerts = False
> > > For Each ws In Worksheets
> > > If ws.Name = "FI (*)" Then ws.Delete
> > > Next
> > > Application.DisplayAlerts = True
> > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete selected worksheets Casey Microsoft Excel Programming 4 14th Nov 2008 10:48 AM
Looping through selected worksheets and delete a range (e.g., A2:D15) jsaynavong@gmail.com Microsoft Excel Programming 1 10th Oct 2007 01:41 AM
Delete rows at the same time from selected worksheets =?Utf-8?B?Rmlsbw==?= Microsoft Excel Programming 3 5th May 2007 02:41 PM
Macro to take selected cells times a selected cell Craig Microsoft Excel Programming 4 24th Oct 2005 12:54 AM
Help: Macro to to sum across selected visible worksheets maimai Microsoft Excel Programming 1 28th Apr 2004 09:02 AM


Features
 

Advertising
 

Newsgroups
 


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