You may find this code useful. If you have more than just one word to look for and delete the entire row, you highlight the column in your case 'B' then run this code. It asks you to put what words to look for in the input box then deletes the entire row.
Not quite what you are looking for in this case but may come in useful in the future.
Sub DeleteRowInInputBox () Dim s As String, iCol As Long, LR As Long, i As Long Dim R As Range, F As Boolean, j As Long iCol = ActiveCell.Column s = "£" Do While s <> "" s = LCase(InputBox("Enter word to look for")) If s = "" Then Exit Sub LR = Cells(Rows.Count, iCol).End(xlUp).Row For i = 1 To LR If LCase(Cells(i, iCol).Value) Like "*" & s & "*" Then If R Is Nothing Then Set R = Cells(i, iCol) j = j + 1 Else Set R = Union(R, Cells(i, iCol)) j = j + 1 End If F = True ElseIf Cells(i, iCol).Value <> "" Then F = False Else If F Then If R Is Nothing Then Set R = Cells(i, iCol) j = j + 1 Else Set R = Union(R, Cells(i, iCol)) j = j + 1 End If End If End If Next i If Not R Is Nothing Then R.EntireRow.Delete MsgBox j & " rows deleted", vbInformation Set R = Nothing End If F = False Loop End Sub




Reply With Quote