PC Review


Reply
Thread Tools Rate Thread

delete all sheets but one

 
 
hans
Guest
Posts: n/a
 
      22nd Nov 2006
Is there a way to delete all sheets but the active one?

Thanks Hans


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      22nd Nov 2006

Application.Displayalerts = False

For Each sh In Activeworkbook.Worksheets
If sh.Name <> activesheet.name then
sh.Delete
End If
Next sh

Application.Displayalerts = True

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"hans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a way to delete all sheets but the active one?
>
> Thanks Hans
>
>



 
Reply With Quote
 
Sandy
Guest
Posts: n/a
 
      22nd Nov 2006
Sub DeleteAll()
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Worksheets
If Not ws Is ActiveSheet Then
ws.Delete
End If
Next
Application.DisplayAlerts = True
End Sub


Sandy

hans wrote:
> Is there a way to delete all sheets but the active one?
>
> Thanks Hans


 
Reply With Quote
 
hans
Guest
Posts: n/a
 
      22nd Nov 2006
Thanks Hans


"Sandy" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Sub DeleteAll()
> Dim ws As Worksheet
> Application.DisplayAlerts = False
> For Each ws In Worksheets
> If Not ws Is ActiveSheet Then
> ws.Delete
> End If
> Next
> Application.DisplayAlerts = True
> End Sub
>
>
> Sandy
>
> hans wrote:
>> Is there a way to delete all sheets but the active one?
>>
>> Thanks Hans

>



 
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
sub to delete all sheets other than x, y, z Max Microsoft Excel Programming 6 2nd Jan 2008 01:04 AM
Delete Sheets Andibevan Microsoft Excel Programming 3 24th Jun 2005 12:17 AM
Re: Macro to delete sheets and saves remaining file does not properly delete module gazornenplat Microsoft Excel Programming 0 22nd Jun 2005 01:12 AM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Microsoft Excel Programming 7 21st Jun 2005 05:16 PM
delete all sheets except... caroline Microsoft Excel Programming 4 22nd May 2004 04:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 PM.