Sub testshts()
Application.DisplayAlerts = False
On Error Resume Next
For i = Worksheets.Count To 2 Step -1
If Sheets(i).Cells.Find(What:="*", After:=[A1], _
SearchDirection:=xlPrevious).Address = " " Then
'MsgBox Sheets(i).Name
Sheets(i).Delete
End If
Next i
Application.DisplayAlerts = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Sal" <(E-Mail Removed)> wrote in message
news:8900C852-6FBF-490F-B940-(E-Mail Removed)...
>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
>