Trouble with a conditional row deletion issue.

rkol297

Board Regular
Joined
Nov 12, 2010
Messages
131
Office Version
  1. 365
  2. 2019
Platform
  1. 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)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top