Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Worksheets
Hi
Use Or not And at the end. And is logical AND, meaning "has property A AND has property B". This will be no info in your final section as a sheet cannot have 2 names. regards Paul Rob wrote: I have another question pertainiing to this particular project. By the way, saving the file does help (lol). At the beginning of this monly project there are certain worksheets that need to be deleted. After all the calculations are verified there are certain sheets that need to be deleted. I am using the following code at the beginning: Sub DeleteCCWorksheets() Dim mySht As Worksheet Application.DisplayAlerts = False For Each mySht In ActiveWorkbook.Worksheets If mySht.Name < "Cost Center Template" And mySht.Name < "ytd.srv.inv" And mySht.Name < "InvSrvTemplate" And mySht.Name < "ytd.srv.detail" And mySht.Name < "InvSrvytdTemplate" And mySht.Name < "inv.finance" And mySht.Name < "inv.srv.detail" And mySht.Name < "patti detail 2" And mySht.Name < "dcd.detail" And mySht.Name < "recap" And mySht.Name < "patti detail" And mySht.Name < "detail by item" And mySht.Name < "invoice detail" Then mySht.Delete End If Next mySht Application.DisplayAlerts = True End Sub This code works fine. Here is the code that is to be used at the end: Sub DeleteNonMonth() Application.DisplayAlerts = False For Each mySht In ActiveWorkbook.Worksheets If mySht.Name = "Cost Center Template" And mySht.Name = "ytd.srv.inv" And mySht.Name = "InvSrvTemplate" And mySht.Name = "ytd.srv.detail" And mySht.Name = "InvSrvytdTemplate" And mySht.Name = "inv.srv.detail" And mySht.Name = "patti detail 2" And mySht.Name = "dcd.detail" And mySht.Name = "patti detail" And mySht.Name = "invoice detail" Then mySht.Delete End If Next mySht Application.DisplayAlerts = True End Sub This code does nothing and I don't get an error message. Will someone please help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting worksheets | Excel Discussion (Misc queries) | |||
Deleting WorkSheets MANY | Excel Programming | |||
Help deleting worksheets | Excel Discussion (Misc queries) | |||
Deleting worksheets | Excel Programming | |||
Deleting worksheets | Excel Programming |