My code is doing what I want except it is entering a split on the two sheets in this code anyone know why>?

rkol297

Board Regular
Joined
Nov 12, 2010
Messages
131
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
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 2 Step -1
Select Case Range("E" & iIGMEDCO0F).Value Case "ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
'do nothing
Case Else
If Right(Range("I" & iIGMEDCO0F).Value, 2) <> "-0" _
Then Rows(iIGMEDCO0F).Delete
End Select
Next iIGMEDCO0F





Sheets("PAH MEDCO").Select
Dim CelPAHMEDCO0F As Range, RngPAHMEDCO0F As Range, iPAHMEDCO0F As Long
Set RngPAHMEDCO0F = Columns("I").SpecialCells(xlConstants, xlTextValues)
For iPAHMEDCO0F = RngPAHMEDCO0F.Count To 2 Step -1
Select Case Range("E" & iPAHMEDCO0F).Value Case "ARAL", "BERT", "EPAC", "EPAP", "EPOP", "FL50", "F100", "GLSA", "REMO", "REMP", "RMIP", "RMIV", "VENP", "VENT", "ZEMA", "ZYME", "ZYMF"
'do nothing
Case Else
If Right(Range("I" & iPAHMEDCO0F).Value, 2) <> "-0" _
Then Rows(iPAHMEDCO0F).Delete
End Select
Next iPAHMEDCO0F
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
In future please use CODE tags around the code to make it easier to read, [CODE]*Code goes here*[/CODE]
Code:
*Code goes here

Anyway what do you mean by a split? As far as I can see the code deletes rows that don't have a specific text value in Column E?
A sample of the data at the start of the macro and a sample of how it ends up should help.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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