MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Removing blank rows via VBA


Posted by alfredo sanchez on January 14, 2002 6:54 AM

HI all!
I have several large WorkBooks that I need to work with, all of them have the same column headings and number, some of them have blank rows. Anyone can help me to put some code so I can manage to programatically get rid of these blank rows?
Thanks.


Posted by bob Umlas on January 14, 2002 7:02 AM

Easiest way is to sort -- blanks will go to tbe bottom! However, if you NEED the code, use something like this:
Sub DeleteRows()
For i=range("A65000").end(xlup).row to 2 step -1
if application.counta(rows(i))=0 then rows(i).Delete
Next
End Sub

Posted by alfredo sanchez on January 14, 2002 7:49 AM

Thank you very much, Bob. (nt)