Hi all
I want to code the following: the macro has to delete the entire row if the value of the cell in column AR is "ABC", "DEF", "GHI" or "JKL".
My code deletes only the rows containing ABC and GHI..
Could anybody see what's wrong in the code?
I want to code the following: the macro has to delete the entire row if the value of the cell in column AR is "ABC", "DEF", "GHI" or "JKL".
My code deletes only the rows containing ABC and GHI..
Could anybody see what's wrong in the code?
Code:
Dim i As Range
Dim wsTest As Worksheet
Dim wbDatabase As Workbook
Set wbDatabase = ThisWorkbook
Set wsTest = wbDatabase.Sheets("Overview")
'Delete the information containing ABC, DEF, GHI and JKL.
For Each i In wbDatabase.Sheets("Overview").Range("AR1:AR1000")
If i.Value = "ABC" Or i.Value = "DEF" Or i.Value = "GHI" Or i.Value = "JKL" Then i.EntireRow.Delete
Next i
End Sub