Solved

Delete rows multiple criteria

Posted on 2013-06-27
2
214 Views
Last Modified: 2013-06-28
I have the code below and am trying to delete rows where a value of 15W99 shows and rows where teh value 15W99 is showing in column C - I don't understand what I am doing wrong, but does not seem to work.

Sub DelRows()
Dim Lst     As Long
Dim n       As Long

With Sheets("Compare")
Lst = .Range("C" & .Rows.Count).End(xlUp).Row
For n = Lst To 2 Step -1
    With .Range("C" & n)
        If .Value = "15W99" And _
          .Value = "9RCP8" Then .EntireRow.Delete
       
     

         
        End If
       
       
     
Next n

End With
End Sub
0
Comment
Question by:leezac
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39283203
Use OR instead of AND
0
 

Author Comment

by:leezac
ID: 39284275
I am having error with the End If
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question