hi all! i am using the code below to look at column O and determing if the characters "AB" are somewhere in the cell. (data might be AB, ABCD, ABD, ABC, CDAB, etc)
then if that is true i need to look in the cell just to the right of it (same row) where there will be only 2 choices that can be in that cell, AB or CD. if AB is found in column O and AB is found in column P then the row can stay, likewise for CD and CD. otherwise, say, if AB is found in column O and CD is found in column P then that row has to go!
i am receiving an Application-defined or object-defined error (1004) on the IF statement line
Private Sub CommandButton2_Click()
Dim i As Integer
numrows = Range("o5", Range("o5").End(xlDown)).Rows.Count
Range("o5").Select
For i = 1 To numrows
If Cells(i, 0).Value = "*IN" And Cells(i, 0).Offset(0, 1).Value = Not ("IN") Then ' ERRORS HERE <<<<<<<<<<<
Selection.EntireRow.Delete
ElseIf Cells(i, 0).Value = "*SH*" And Cells(i, 0).Offset(0, 1).Value = Not ("CN") Then
Selection.EntireRow.Delete
End If
Next i
End Sub
what am i doing wrong??
thanks!!
Bookmarks