Macro to delete rows if they do not contain specific text

  • Hello,

    I am currently working on a macro that will scan columns "E" and "I" and if they do not contain "Inserted" or "ClassID" the row should be deleted. I've tried multiple different variations but can't seem to get it right.. below is what I have so far:

    Sub EvaluateD()
    Dim i, LastRow
    Dim UserIDModLog

    UserIDModLog = ActiveSheet.Name

    LastRow = UserIDModLog(Rows.Count).End(xlUp).Row
    For i = LastRow To 1 Step -1
    If UserIDModLog.Value <> "Inserted" Or "ClassID" Then
    End If
    Next i
    End Sub

    Help :(

  • .
    This is one method :

  • Hello and Welcome to the Forum :)

    Feel free to attach a sample file ... with an explanation about your expected result ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!