PDA

View Full Version : Solved: Deleting worksheets



mprija
06-15-2006, 01:40 AM
I need a code/macro which would delete worksheets which contain text or values only in header row (row 1), worksheets which have text or values in other rows should no be deleted. For any help I will be grateful.

johnske
06-15-2006, 02:17 AM
Option Explicit
'
Sub TryThis()
Dim Sheet As Worksheet
Application.DisplayAlerts = False
For Each Sheet In Sheets
If WorksheetFunction.CountA(Cells) = WorksheetFunction.CountA(Rows(1)) _
And WorksheetFunction.CountA(Cells) <> 0 Then
Sheet.Delete
End If
Next
Application.DisplayAlerts = True
End Sub

mprija
06-16-2006, 02:01 AM
Thank you johnske, it works for me.

johnske
06-16-2006, 04:02 AM
Not a prob. :)