Hello
I search for way to delete all of rows don't contain CASH PP, CASH SS.
what I want the code should match part of item CASH PP, CASH SS based on column B becuase will contain characters ,if there rows contain CASH PP, CASH SS regardless what contain characters after it should keep it otherwise delete the others .
Sub deleterows()
Dim sh As Worksheet
Dim rng As Range
Dim i As Long, lr As Long
Set sh = Sheets("Sheet1")
lr = sh.Range("B" & Rows.Count).End(3).Row
Set rng = sh.Range("B" & lr + 1)
For i = 1 To lr
Select Case UCase(sh.Range("B" & i).Value)
Case "CASH PP", "CASH SS"
Case Else: Set rng = Union(rng, sh.Range("B" & i))
End Select
Next
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
rng.EntireRow.Delete
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub