delete row if a cell is blank

S

Steve Mackay

Hi All,

I would like to write a basic macro that will search a column and
delete a row if the cell is blank

A
1 Orange
2
3 Apple
4 Pear
5
6 Grape

For instance, I would like the macro to delete rows two and five in the
above example. The number of rows to search will vary, so maybe it
would be easier to start at the bottom of the worksheet and work up.
Also, there may be text in other columns, so the whole row won't
necessarily be blank.

Thanks,
Steve
 
S

Steve Mackay

Nevermind, I think I was able to find the answer from Dave Ritchie.

Thanks!
Steve

Sub EliminateBlankColumnC()
On Error Resume Next ' In case there are no blanks
Columns("C:C").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange 'Resets UsedRange for Excel 97
End Sub
 

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.

Ask a Question

Top