Solved

find matching data and remove

Posted on 2014-09-16
2
87 Views
Last Modified: 2014-09-16
I have attached a file that will make clear what I am looking for but briefly I need vba code that will remove rows under the below criteria.

When Ref Type (column c) contains both ABCD and WXYZ for a matching Dept (column K) and  xd same [Column D] - remove ABCD event and keep WXYZ only.

The VBA needs to loop to end as there will be different number of rows each time my report is run

Thanks in advance
IfSame.xlsx
0
Comment
Question by:Jagwarman
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40325200
Sub Remove()
For introw = 9999 To 1 Step -1
    If Cells(introw, 3) = "ABCD" Then
        For introw2 = 9999 To 1 Step -1
            If Cells(introw2, 3) = "WXYZ" And Cells(introw2, 11) = Cells(introw, 11) Then
                Rows(introw).Delete
                Exit For
            End If
        Next
    End If
Next
End Sub
0
 

Author Comment

by:Jagwarman
ID: 40325217
Can't believe you did that so quickly thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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.
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…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

910 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

24 Experts available now in Live!

Get 1:1 Help Now