Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Greetings, all.
Would someone help me write code to for my workbook to delete a worksheet(s) if I have two empty cells? For example, if I have a date cell AND a job number cell empty I would need that worksheet deleted. Any help would be much appreciated. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200908/1 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Perhaps something like this:
Sub DeleteSheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets 'Change ranges as appropriate If ws.Range("A4") = "" And ws.Range("B4") = "" Then Application.DisplayAlerts = False ws.Delete Application.DisplayAlerts = True End If Next End Sub -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Mark_F via OfficeKB.com" wrote: Greetings, all. Would someone help me write code to for my workbook to delete a worksheet(s) if I have two empty cells? For example, if I have a date cell AND a job number cell empty I would need that worksheet deleted. Any help would be much appreciated. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200908/1 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you, Luke, for your response. I will give it a try!
Luke M wrote: Perhaps something like this: Sub DeleteSheets() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets 'Change ranges as appropriate If ws.Range("A4") = "" And ws.Range("B4") = "" Then Application.DisplayAlerts = False ws.Delete Application.DisplayAlerts = True End If Next End Sub Greetings, all. [quoted text clipped - 3 lines] Any help would be much appreciated. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200908/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Marco to Delete Worksheets | Excel Discussion (Misc queries) | |||
How to delete blank worksheets | Excel Worksheet Functions | |||
Delete All Worksheets Apart From Some With Particular Name | Excel Discussion (Misc queries) | |||
I can't delete my worksheets | Excel Discussion (Misc queries) | |||
Add or Delete Rows in Protected worksheets | Excel Discussion (Misc queries) |