VBA loop to delete entire row if cells contain a particular string


I need code to go through cells of a column of unknown length and delete the entire row if the cells contain a particular string ("--"). This is what I have so far, but it does not work. Can anyone help? I can't program.

Dim RowKdx As Long
For RowKdx = Range("b1").End(xlDown).Row To 2 Step -1
Do While Cells(RowKdx, "b").Value <> ""
If InStr(RowKdx, "--") = 1 Then
End If
RowKdx = RowKdx - 1
If RowKdx = 1 Then Exit For
Next RowKdx

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!