Here's a quick and dirty run through. Highlight the cells containing the values you're testing against and then run this:
Public Sub seekAndDestroy()
Dim rng As Range
For Each rng In Selection
If ((InStr(1, rng.Value, "2051") <> 0 And InStr(1, rng.Value, "S1") <> 0) Or _
(InStr(1, rng.Value, "3051S") <> 0 And InStr(1, rng.Value, "D11") <> 0)) Then
rng.EntireRow.Clear
End If
Next
End Sub
Note that it clears the entire row. When looping through a Selection it gets kinda tricky when you delete a range contained within. Excel doesn't really take into account the Selection changes when you delete/add within it. You can code around that, of course, but I'm keeping it basic.
Bookmarks