Regards,
Kevin
~~~~~~~~~~~~~~~~
This deletes any row that has a blank cell in column A. This should work
for you if that condition means the row is blank. Blank, of course, means
the cell is empty. With a text file, there could be spaces in the cell and
they only look blank.
Sub DeleteRows()
Set rng = Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp))
Set rng = rng.SpecialCells(xlBlanks)
rng.EntireRow.Delete
ActiveWorkbook.Close SaveChanges:=True
End Sub
One way around it this is to add a helper column that will contain the original
number of the row.
Insert a new column A.
Put 1 in A1
put 2 in A2
Select A1:A2 and drag down your list.
Sort your data to get the blanks at the bottom.
Delete those (almost) blank rows (they now have row numbers).
Resort your data by column A (the original row numbers).
Delete column A.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.