rkol297
Board Regular
- Joined
- Nov 12, 2010
- Messages
- 131
- Office Version
- 365
- 2019
- Platform
- Windows
I have data in columns A through W with the number of rows varying with each run of the report which means the report could have 500 - 4000 rows each time it runs. What I'm trying to do is look at column "I" and keep any row that the value in column "I" ending with "-0". This is the code I have figured out and it works if I just want to keep values ending in "-0".
Dim CelMEDCO0F As Range, RngMEDCO0F As Range, iMEDCO0F As Long
Set RngMEDCO0F = Columns("I").SpecialCells(xlConstants, xlTextValues)
For iMEDCO0F = RngMEDCO0F.Count To 1 Step -1
If RngMEDCO0F(iMEDCO0F).Value Like "*-0*" _
Then RngMEDCO0F(iMEDCO0F).EntireRow.Delete
Next iMEDCO0F
However, I need to also keep rows that contain specific values in column "E" and these rows may have a value in column "I" that does not end in "-0" which is OK i still need to keep the row.
The specific values in column "E" that I must keep are:
ARAL, BERT, EPAC, EPAP, EPOP, FL50, F100, GLSA, REMO, REMP, RMIP, RMIV, VENP, VENT, ZEMA, ZYME, ZYMF
So i need to keep all rows that have the above specific values in column E regardless of what the value in Column I ends in, but if the value in E is not one of the above and the value in I does not end in "-0" delete entire row.
The spec
Dim CelMEDCO0F As Range, RngMEDCO0F As Range, iMEDCO0F As Long
Set RngMEDCO0F = Columns("I").SpecialCells(xlConstants, xlTextValues)
For iMEDCO0F = RngMEDCO0F.Count To 1 Step -1
If RngMEDCO0F(iMEDCO0F).Value Like "*-0*" _
Then RngMEDCO0F(iMEDCO0F).EntireRow.Delete
Next iMEDCO0F
However, I need to also keep rows that contain specific values in column "E" and these rows may have a value in column "I" that does not end in "-0" which is OK i still need to keep the row.
The specific values in column "E" that I must keep are:
ARAL, BERT, EPAC, EPAP, EPOP, FL50, F100, GLSA, REMO, REMP, RMIP, RMIV, VENP, VENT, ZEMA, ZYME, ZYMF
So i need to keep all rows that have the above specific values in column E regardless of what the value in Column I ends in, but if the value in E is not one of the above and the value in I does not end in "-0" delete entire row.
The spec