Delete a row if blank cell

  • Thread starter mohd21uk via OfficeKB.com
  • 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
 
C

CLR

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
 
D

Don Guillett

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
 

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