Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Macro to delete sheets

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Macro to delete sheets

Application.DisplayAlerts=False
Worksheets("PLANID ").Delete
Worksheets("FEETOTAL ").Delete
Application.DisplayAlerts=True


"Jodie" wrote in message
...
How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Macro to delete sheets

remove the unwanted space after the sheet name and quote mark - happened
when I copied the names.
Application.DisplayAlerts=False
Worksheets("PLANID").Delete
Worksheets("FEETOTAL").Delete
Application.DisplayAlerts=True




"Patrick Molloy" wrote in message
...
Application.DisplayAlerts=False
Worksheets("PLANID ").Delete
Worksheets("FEETOTAL ").Delete
Application.DisplayAlerts=True


"Jodie" wrote in message
...
How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Macro to delete sheets

Try this
Sub deleteSheets()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
With Application
.DisplayAlerts = False
With ws
If .Name = "PLANID" Or .Name = "FEETOTAL" Then
.Delete
End If
End With
.DisplayAlerts = True
End With
Next
End Sub

"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Macro to delete sheets

try this
Sub deleteSheets()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
With Application
.DisplayAlerts = False
With ws
If .Name = "PLANID" Or .Name = "FEETOTAL" Then
.Delete
End If
End With
.DisplayAlerts = True
End With
Next
End Sub

"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Macro to delete sheets

sub deleter()

worksheets("PLANID").delete
worksheets("FEETOTAL").delete

end


"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Macro to delete sheets

Sheets("PLANID").Delete

"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro to delete sheets

Sub Macro()
Application.DisplayAlerts = False
Sheets("Sheet2").Delete
'To delete more than one sheet
'Sheets(Array("Sheet2", "Sheet3")).Delete
Application.DisplayAlerts = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro to delete sheets

Sub SheetKiller()
Application.DisplayAlerts = False
Sheets("PLANID").Delete
Sheets("FEETOTAL").Delete
Application.DisplayAlerts = True
End Sub

--
Gary''s Student - gsnu200908
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Macro to delete sheets

sub deleter()

worksheets("PLANID").delete
worksheets("FEETOTAL").delete

end


"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro to delete sheets

Sub Macro()
Application.DisplayAlerts = False
Sheets("PLANID").Delete
'to delete both
'Sheets(Array("PLANID","FEETOTAL")).Delete
Application.DisplayAlerts = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Macro to delete sheets

Thank you Mike, this worked great and did not give me any pop up messages
about permanently deleting sheets.
--
Thank you, Jodie


"Mike" wrote:

Try this
Sub deleteSheets()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
With Application
.DisplayAlerts = False
With ws
If .Name = "PLANID" Or .Name = "FEETOTAL" Then
.Delete
End If
End With
.DisplayAlerts = True
End With
Next
End Sub

"Jodie" wrote:

How can I delete sheets with the names PLANID or FEETOTAL through VBA?
--
Thank you, Jodie

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 delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:16 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 04:38 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:20 PM


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