KEEPing rows with specific field values, and DELETING all others

  • Thread starter Thread starter Gauthier
  • Start date Start date
G

Gauthier

Hi there...i am hoping someone could give me a hand -
i've put together the following code which in essence KEEPS all rows with
the following conditions
1 - all rows that contain SEQ: T in column A
2 - all rows that contain TOTAL in column A
3 - all rows that contain SVC in column B
4 - all rows that contain EXCHANGE in column C
and DELETES all other rows...

code works for all the conditions EXCEPT #4...

column C, amongst other values, contains the phrase: EXCHANGE RATE: 1.554
the rate (1.554 changes thruout), so i want any rows beginning with
"EXCHANGE" to REMAIN...

would appreciate your assistance...
*************************************************************************
Dim x As Long
For x = Range("A65536").End(xlUp).Row To 1 Step -1
If Range("A" & x) <> "SEQ: T" And Range("A" & x) <> "TOTAL" And
Range("B" & x) <> "SVC" And Range("C" & x) <> "EXCHANGE*" Then
Range("A" & x).EntireRow.Delete
End If
Next
 
Dim x As Long
For x = Range("A65536").End(xlUp).Row To 1 Step -1
If Range("A" & x) <> "SEQ: T" And _
Range("A" & x) <> "TOTAL" And _
Range("B" & x) <> "SVC" And _
Left(Range("C" & x),8) <> "EXCHANGE" Then
Range("A" & x).EntireRow.Delete
End If
Next
 
Back
Top