Hi -- found a good script for this, but I need to delete rows that contain different variables and I don't know how to run that several times at one go - fr example delete all lines containing Fred,Paul, or Jim
This was the original script in the previous reply to another members question: --- it requires input fr the string, but I would prefer knowing how I could just embed the terms. Thanks in advance for help on this
Sub deleteRows()
Dim rng As Range
Dim rng2 As Range
Dim cl As Range
Dim str As String
str = InputBox("Enter search text", "Find & Delete")
If str = "" Then Exit Sub
Set rng = ActiveSheet.UsedRange
For Each cl In rng
If cl.Value Like "*" & str & "*" Then
If rng2 Is Nothing Then
Set rng2 = cl
Else: Set rng2 = Union(rng2, cl)
End If
End If
Next cl
rng2.EntireRow.Delete
Moderator's Note: When posting codes. Select the code then hit "#" sign to enclose the codes with code tags. Thank you and welcome to the forum.
Bookmarks