Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete rows multiple criteria

Posted on 2013-06-27
2
Medium Priority
?
222 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

916 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