Solved

Delete rows multiple criteria

Posted on 2013-06-27
2
211 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now