- Nov 12, 2010
- Office Version
I need to modify the code below so that if any of the values X,Y,Z,A,B,C...etc are present in any of the columns C,D,E,F,G,H do not delete the row. But if NONE of the values X,Y,Z,A,B,C...etc are present in C,D,E,F,G,H then delete entire row?
Rich (BB code):
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 UCase(Trim(Range("E" & iIGMEDCO0F).Value)) Case "X", "Y", "Z", "A", "B", "C" 'do nothing Case Else Rows(iIGMEDCO0F).Delete End Select Next iIGMEDCO0F