Hi!
I have this code deleting all rows that do not contain the text "A#ABN" in column A. However, I also need to keep rows containing the value "A#UUW" also. Single delete works perfectly, but I struggle when adding more criteria. I´ve tried different versions of code two, but still noting
1) This one works fine:
2) This does not work:
I have this code deleting all rows that do not contain the text "A#ABN" in column A. However, I also need to keep rows containing the value "A#UUW" also. Single delete works perfectly, but I struggle when adding more criteria. I´ve tried different versions of code two, but still noting
1) This one works fine:
Code:
Sub delete_row()
Dim r As Long, lr As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
For r = lr To 2 Step -1
If InStr(Cells(r, 1), "A#ABN") = 0 Then Rows(r).Delete
Next r
End Sub
2) This does not work:
Code:
Sub delete_row()
Dim r As Long, lr As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
For r = lr To 2 Step -1
If InStr(Cells(r, 1), "A#ABN" [U][I]Or "A#UUW")[/I][/U] = 0 Then Rows(r).Delete
Next r
End Sub