vba remove rows based on criteria

I need a vba code that will remove rows where:

Column A is = "GR" or "HD" or "MWT" AND
Column C is <> {2,3,4,5,6,7,8}

In other words, if column A is "GR", "HD" or "MWT" column C can only be one of these numbers 2,3,4,5,6,7.
If the column A is anything else, leave the row.

Thanks very much if you can help!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
Public Sub RemoveTheseRows()
    Dim Max     As Integer
    Dim Row     As Integer

    Max = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row

    For Row = Max To 2 Step -1  ' We go backwards for row deleting simplicity
        Cells(Row, 1).Select
        Select Case UCase(Cells(Row, 1).Value)
            Case "GR", "HD", "MWT"
                If Cells(Row, 3).Value < 2 Or Cells(Row, 3) > 8 Then
                    Cells(Row, 1).EntireRow.Delete
                End If
        End Select
    Next Row
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerCommented:
Sub delfiltered()
    Dim lastrow As Long
    lastrow = Range("C" & Rows.Count).End(xlUp).Row
    Range("D2:D" & lastrow).FormulaR1C1 = _
    Range("A1").AutoFilter Field:=4, Criteria1:="1"
    Range("A2:A" & lastrow).EntireRow.SpecialCells(xlCellTypeVisible).Delete
End Sub
Euro5Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.