Hi everyone!
Some time ago SirJB helped me with this code to loop through 2 columns of text and delete the rows whenever a certain criteria is met.
I'm facing a new challenge now, I want it to search for several words, like 200, and delete the row whenever any of those words appear. Also, it needs to be case sensitive.
Here's the code from last time:
[pre]
[/pre]
The criteria in the example above is "House", but I'd need it to search for a lot more words, and whenever any of these words show up, delete the whole row.
I could add endless "OR"s in there, but I'm affraid it'd make it impossible to run.
I really appreciate your help.
Thanks!!
Some time ago SirJB helped me with this code to loop through 2 columns of text and delete the rows whenever a certain criteria is met.
I'm facing a new challenge now, I want it to search for several words, like 200, and delete the row whenever any of those words appear. Also, it needs to be case sensitive.
Here's the code from last time:
[pre]
Code:
Sub Test()
Dim rng As Range
Dim I As Long, J As Integer
Set rng = Worksheets("Hoja1").[A1:B10]
With rng
For I = .Rows.Count To 1 Step -1
For J = 1 To .Columns.Count
If .Cells(I, J).Value = "House" Then
.Cells(I, J).EntireRow.Delete xlUp
Exit For
End If
Next J
Next I
End With
Set rng = Nothing
End Sub
The criteria in the example above is "House", but I'd need it to search for a lot more words, and whenever any of these words show up, delete the whole row.
I could add endless "OR"s in there, but I'm affraid it'd make it impossible to run.
I really appreciate your help.
Thanks!!