PDA

View Full Version : Deleting Rows



joeyc
10-21-2008, 02:33 PM
Hello,

I would like to draft a macro so that it deletes the second row of every sheet in the workbook based upon one condition. The condition is if the 2nd row on a given worksheet is blank then delete this row if not leave it alone and go to the next worksheet and check the 2nd row there. Naturally, the number of worksheet in the workbook is undefined.

Thank you in advance for any help.

Bob Phillips
10-21-2008, 02:58 PM
For Each ws In Activeworkbook.Worksheets

If Application.CountBlank(ws.Rows(2)) = ws.Columns.Count Then

ws.Rows(2).Delete
End If
Next ws

joeyc
10-21-2008, 03:24 PM
Nice work!

:bow: