Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
(Untested) This should do what you want...
Sub DeleteEmptySheets2or3() Application.DisplayAlerts = False If Sheets("Sheet2").Cells.Find("*") Is Nothing Then Sheets("Sheet2").Delete If Sheets("Sheet3").Cells.Find("*") Is Nothing Then Sheets("Sheet3").Delete Application.DisplayAlerts = True End Sub -- Rick (MVP - Excel) "Sal" wrote in message ... I would like to get help to improve the macro below so that if Sheet2 or Sheet3 or both, have no contents in their worksheets they will get deleted. On the other hand if Sheet2 or Sheet3, or both have contents they will stay. Here is the code I have right now. Thank you for your help. Sub Deletesheetswithoutcontents() Application.DisplayAlerts = False Sheets("Sheet2").Delete Sheets("Sheet3").Delete Application.DisplayAlerts = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming |