Link to home
Start Free TrialLog in
Avatar of Michael Noze
Michael Noze

asked on

Remove entire row with criteria

Hi Experts,

I'm trying to code a simple function to delete an entire and do a shift up to replace the deleted row.
when the value of a cell in column A contains "A" or "OQ" or "la" or "lq"
I've coded this, but isn't working properly.

Is there a solution to this?

Thank you

Sub DeleteRow()

Dim SrchRng As Range, cel As Range
Application.ScreenUpdating = False
Set SrchRng = Range("A:A")

For Each cel In SrchRng
    If Not InStr(1, cel.Value, "A") > 0 Then
        Worksheets("Feuille1").Rows(cel.Row).Delete Shift:=xlShiftUp
    End If
Next cel
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Noze
Michael Noze

ASKER

Thanks! It works perfectly!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial