Delete a row if blank cell

  • Thread starter Thread starter mohd21uk via OfficeKB.com
  • Start date Start date
M

mohd21uk via OfficeKB.com

Hi,

I would like to delete a row if the a cell in a column is blank. For e.g. if
a cell in column E is blank I would like to delete the whole row. I would
like to do this in VBA code
 
Here's one I got from the group some time ago.....sorry, don't remember who
or when..........

Public Sub DeleteBlanks()
With ActiveSheet
.Range(.Cells(1, ActiveCell.Column), _
.Cells(65536, ActiveCell.Column)).Select
End With
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange
ActiveCell.Select
End Sub

Vaya con Dios,
Chuck, CABGx3
 
or

Sub DeleteBlankRowsInActiveColumn()
ac = ActiveCell.Column
lr = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
Range(Cells(1, ac), Cells(lr, ac)). _
SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
 
Back
Top