One way:
Sub test()
Const strCriteria As String = "remittance"
Dim rngData As Range
Dim rngCell As Range
Dim rngDelete As Range
With Worksheets("Sheet1") '<<<<<Change
Set rngData = Intersect(.UsedRange, .Columns(2))
End With
For Each rngCell In rngData
If LCase(rngCell.Value) <> LCase(strCriteria) Then
If rngDelete Is Nothing Then
Set rngDelete = rngCell
Else: Set rngDelete = Union(rngDelete, rngCell)
End If
End If
Next rngCell
If Not rngDelete Is Nothing Then _
rngDelete.EntireRow.Delete
End Sub
"SITCFanTN" wrote:
> I have a spreadsheet with 8 columns. I want to delete all rows that don't
> have the text "Remittance" in column B. I would like to put the code in an
> existing macro. Is this very difficult? Thanks
Bookmarks