K
Kobayashi
I've been trying all day to crack this without success. Any help would
be very much appreciated!
Here is my code. There must be a better way, using either a look-up
table or Select Case statement to do this but I'm not yet experienced
enough to work it out.
The below works, to a point, until it starts deleting the rows! Then,
because it shifts the row up it jumps a row so I need a way to address
this using some kind of statement?
lLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set myRange = WorCtrlsheet.Range("b2", Cells(lLastRow, "b"))
With myRange
For Each Cell In myRange
If Cell.Value <> "Criteria 1" And _
Cell.Value <> "Criteria 2" And _
Cell.Value <> "Criteria 3" And _
Cell.Value <> "Criteria 4" And _
Cell.Value <> "Criteria 5" And _
Cell.Value <> "Criteria 6" And _
Cell.Value <> "Criteria 7" And _
Cell.Value <> "Criteria 8" And _
Cell.Value <> "Criteria 9" And _
Cell.Value <> "Criteria 10" And _
Cell.Value <> "Criteria 11" And _
Cell.Value <> "Criteria 12" And _
Cell.Value <> "Criteria 13" And _
Cell.Value <> "Criteria 14" Then
Cell.EntireRow.Delete
End If
Next i
be very much appreciated!
Here is my code. There must be a better way, using either a look-up
table or Select Case statement to do this but I'm not yet experienced
enough to work it out.
The below works, to a point, until it starts deleting the rows! Then,
because it shifts the row up it jumps a row so I need a way to address
this using some kind of statement?
lLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set myRange = WorCtrlsheet.Range("b2", Cells(lLastRow, "b"))
With myRange
For Each Cell In myRange
If Cell.Value <> "Criteria 1" And _
Cell.Value <> "Criteria 2" And _
Cell.Value <> "Criteria 3" And _
Cell.Value <> "Criteria 4" And _
Cell.Value <> "Criteria 5" And _
Cell.Value <> "Criteria 6" And _
Cell.Value <> "Criteria 7" And _
Cell.Value <> "Criteria 8" And _
Cell.Value <> "Criteria 9" And _
Cell.Value <> "Criteria 10" And _
Cell.Value <> "Criteria 11" And _
Cell.Value <> "Criteria 12" And _
Cell.Value <> "Criteria 13" And _
Cell.Value <> "Criteria 14" Then
Cell.EntireRow.Delete
End If
Next i