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
    Else
    UserIDModLog.EntireRow.Delete
    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 "Like" icon ...just below...in the bottom right corner...:)