0
votes

I am able to delete certain text named "total" but i am also trying to delete another one at the same time how do i go about adding a second or third find.

Sub Macro4() Dim c As Range Dim SrchRng

Set SrchRng = ActiveSheet.Range("C1", ActiveSheet.Range("C65536").End(xlUp))
Do
    Set c = SrchRng.Find("Total", LookIn:=xlValues)
    If Not c Is Nothing Then c.EntireRow.Clear
Loop While Not c Is Nothing

End Sub

1
Will the other values also be found in column C?Gary's Student
yes they will be in the same columnGabriel

1 Answers

0
votes

Give this a try:

Sub MultiClear()
    Dim SrchRng As Range, c As Range, v As Variant
    Set SrchRng = ActiveSheet.Range("C1", ActiveSheet.Range("C65536").End(xlUp))
    For Each c In SrchRng
        v = c.Value
        If InStr(v, "Total") > 0 Or InStr(v, "happy") > 0 Or InStr(v, "sad") > 0 Then
            c.EntireRow.Clear
        End If
    Next c
End Sub

Of course use your own values rather than happy or sad.