Solved

Delete rows multiple criteria

Posted on 2013-06-27
2
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

617 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