Hi,

I am writing a code to delete rows from a sheet by matching array values with cells in a column. My code is not generating any error, but, it is also not deleting rows as well. Clearly, there is fundamentally wrong with my logic. PLEASE HELP!!!!

Sub delRow()

Dim myRange As Range

Dim all As Range

Dim b As Boolean

Dim delArray As Variant

Dim i As Integer

delArray = Array("Niel", "Barry")


For i = LBound(delArray) To UBound(delArray)

If Range("oRange").Cells(17).Value = delArray(i) Then

If b Then
myRange = Range("oRange").CurrentRegion.Rows
Set all = Application.Union(myRange, all)
Else
Set all = myRange
b = True
End If

End If

Next i

If Not all Is Nothing Then all.EntireRow.Delete

End Sub