rkol297
Board Regular
- Joined
- Nov 12, 2010
- Messages
- 131
- Office Version
- 365
- 2019
- Platform
- Windows
I have this code however it is not doing what I need it to do:
Sheets("IG MEDCO").Select
Dim CelIGMEDCO0F As Range, RngIGMEDCO0F As Range, iIGMEDCO0F As Long
Set RngIGMEDCO0F = Columns("I").SpecialCells(xlConstants, xlTextValues)
For iIGMEDCO0F = RngIGMEDCO0F.Count To 1 Step -1
If RngIGMEDCO0F(iIGMEDCO0F).Value Like "*-0*" Then
Select Case Range("E" & RngIGMEDCO0F(iIGMEDCO0F).Row).Value
Case "ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
Case Else
If Right(Range("I" & iIGMEDCO0F).Value, 2) <> "*-0*" _
Then Rows(iIGMEDCO0F).Delete
End Select
End If
Next iIGMEDCO0F
With these examples below to help explain I need to modify the code so that if column E contains:
"ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
Keep the row regardless of the value of column "I"
If the value of Column E is NOT one of the values above delete entire row UNLESS the value in column "I" ends in "-0"
Here are some examples to assist:
Column E: Column I:
GGIS 659568-0 <-keep (GGIS is not on list but I ends in -0)
GIMN 659586-5 <- delete row (not on list in column E and "I" doesnt end in -0
FRTS 6548905-0 <- keep (FRTS isnt on list but I ends in -0)
ZEMA 5894512-0 <-Keep (zema is on the list)
ZEMA 5895625-9 <-keep (zema is on the list)
Sheets("IG MEDCO").Select
Dim CelIGMEDCO0F As Range, RngIGMEDCO0F As Range, iIGMEDCO0F As Long
Set RngIGMEDCO0F = Columns("I").SpecialCells(xlConstants, xlTextValues)
For iIGMEDCO0F = RngIGMEDCO0F.Count To 1 Step -1
If RngIGMEDCO0F(iIGMEDCO0F).Value Like "*-0*" Then
Select Case Range("E" & RngIGMEDCO0F(iIGMEDCO0F).Row).Value
Case "ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
Case Else
If Right(Range("I" & iIGMEDCO0F).Value, 2) <> "*-0*" _
Then Rows(iIGMEDCO0F).Delete
End Select
End If
Next iIGMEDCO0F
With these examples below to help explain I need to modify the code so that if column E contains:
"ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
Keep the row regardless of the value of column "I"
If the value of Column E is NOT one of the values above delete entire row UNLESS the value in column "I" ends in "-0"
Here are some examples to assist:
Column E: Column I:
GGIS 659568-0 <-keep (GGIS is not on list but I ends in -0)
GIMN 659586-5 <- delete row (not on list in column E and "I" doesnt end in -0
FRTS 6548905-0 <- keep (FRTS isnt on list but I ends in -0)
ZEMA 5894512-0 <-Keep (zema is on the list)
ZEMA 5895625-9 <-keep (zema is on the list)