Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Use macro to delete worksheet without specific name Eg:Sheet 1

Hello Everybody,

Need help again !! I need a macro to delete active worksheets without a
specific
worksheet name eg: Sheet7, Sheet8 & Sheet9, etc. I had tried this statement
but it don't work.. Is there anyone can help me ??

Activesheet.Delete

Thank You Very Much !!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Use macro to delete worksheet without specific name Eg:Sheet 1

Why and how doesn't it work?

--
__________________________________
HTH

Bob

"Delight" wrote in message
...
Hello Everybody,

Need help again !! I need a macro to delete active worksheets without a
specific
worksheet name eg: Sheet7, Sheet8 & Sheet9, etc. I had tried this
statement
but it don't work.. Is there anyone can help me ??

Activesheet.Delete

Thank You Very Much !!!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Use macro to delete worksheet without specific name Eg:Sheet 1

Sub JustKillMe()
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

--
Gary''s Student - gsnu200814
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use macro to delete worksheet without specific name Eg:Sheet 1


I think a much better version of the code would be:

Sub Del_Sheets()
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In Sheets
If Left(sh.Name, 5) = "Sheet" Then
sh.Delete
End If
Next
Application.DisplayAlerts = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=30854

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Use macro to delete worksheet without specific name Eg:Sheet 1

Hi Simon;

That is an interesting interpretation of the question.
--
Gary''s Student - gsnu200814


"Simon Lloyd" wrote:


I think a much better version of the code would be:

Sub Del_Sheets()
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In Sheets
If Left(sh.Name, 5) = "Sheet" Then
sh.Delete
End If
Next
Application.DisplayAlerts = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=30854




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Use macro to delete worksheet without specific name Eg:Sheet 1

Hello Everybody,

Thanks for the help !! Simon, I followed your method and I get what I want.

Thanks !!


"Gary''s Student" wrote:

Hi Simon;

That is an interesting interpretation of the question.
--
Gary''s Student - gsnu200814


"Simon Lloyd" wrote:


I think a much better version of the code would be:

Sub Del_Sheets()
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In Sheets
If Left(sh.Name, 5) = "Sheet" Then
sh.Delete
End If
Next
Application.DisplayAlerts = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=30854


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
Macro to copy a workbook and delete a specific worksheet dgd1212 Excel Programming 5 March 23rd 08 09:45 PM
Macro to delete specific cells orquidea Excel Programming 4 October 29th 07 01:13 AM
Macro to delete specific rows Gert-Jan[_2_] Excel Programming 2 December 20th 06 09:29 AM
How to delete worksheet with specific criteria Angus Excel Programming 1 July 5th 05 10:44 AM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM


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