An Excel macro that deletes rows if certain values ​​exist in a cell, and then will they concatenate?

advertisements

I can't seem to piece together VBA code that will delete a row if certain strings exist in a cell. I can easily do it for only one, but can't figure out how to include multiple strings.

I've got the last part down, which is easy, just applying a concatenate formula to a range, but I have tried many things to get the first part right and nothing works.

Below is what I have hacked together and it will only work to delete rows if ONE particular string is in them "None". I need to also delete rows if the words "Subtotal", "Estimate, and "Empty" are in the cell.

With Sheets("Customer Copy")
    Firstrow = .UsedRange.Cells(1).Row
    Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
    For Lrow = Lastrow To Firstrow Step -1
    With .Cells(Lrow, "B")
    If Not IsError(.Value) Then

                If .Value = "None" Then .EntireRow.Delete

    End If

        End With

    Next Lrow

End With

    Worksheets("Customer Copy").Range("A1:A200").Formula = "=CONCATENATE(B1, D1, E1)"

Thank you for any help!!!


I think this would work

If .Value = "None" or .Value = "Subtotal" or .Value = "Estimate" or .Value = "Empty" Then