PDA

View Full Version : Row Delete



Mykasd
10-04-2007, 01:01 PM
I am trying to delete rows where the cell of that row in column B is empty. Any Idea how to do this?

Mykasd
10-04-2007, 01:02 PM
And it has to loop through until it reaches the end of the data set (data set changes in size). So it could be 200 rows or it could be 10.

Bob Phillips
10-04-2007, 01:12 PM
Public Sub ProcessData()
Const TEST_COLUMN As String = "B" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

Application.ScreenUpdating = False

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
If .Cells(i, TEST_COLUMN).Value = "" Then .Rows(i).Delete
Next i

Application.ScreenUpdating = True
End With

End Sub

Mykasd
10-04-2007, 01:17 PM
that works brilliantly. thank you