Total Pageviews

Monday 20 October 2014

Delete Entire row if cell is blank or single space using VBA


Lets assume you want to delete Entire row if the cell is blank or having single space in column A, then you can try the below code.


Sub Cells_Blank_OneSpace_EntireRowDelete()
On Error Resume Next
With Range("A2:A1000")
    .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    .Replace " ", "#N/A", xlWhole
    .SpecialCells(xlConstants, xlErrors).EntireRow.Delete
End With
End Sub

No comments:

Post a Comment