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

VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
byundt

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
byundt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Michael Noze

ASKER
Thanks! It works perfectly!
SOLUTION
byundt

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck