Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delete rows multiple criteria

Posted on 2013-06-27
2
Medium Priority
?
220 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 2000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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 …

722 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