mercredi 18 décembre 2019

Exception to an If, Then statement

For a data dump 100k+ lines I am trying to erase all non-zeros that occur in two columns. However, if there is a specific set of values in a 3rd column I do not erase that line. Please help! Below is my code:

Dim N As Long, i As Long
    N = Cells(Rows.Count, "V").End(xlUp).Row
    For i = N To 2 Step -1
        If (Cells(i, "V") <> "0" Or Cells(i, "X") <> "0") Then
            'need to add a line that will erase all non zeros except if they contain MX, AA, etc.
            Cells(i, "H").EntireRow.Delete
        End If
    Next i

Aucun commentaire:

Enregistrer un commentaire