Crosscheck and Delete Data

Posted on 2011-10-31
Last Modified: 2012-05-12
Hi Experts,

I would like to request Experts help create a macro to crosscheck data at Column D (Detail Sheet) with Column D at "Main Sheet". If the data matched, delete the whole row of the data from the "Detail Sheet". Hope Experts could help me create this feature. Attached the workbook for Experts perusal.
Question by:Cartillo
    LVL 24

    Accepted Solution

    Cartillo - try this:
    Sub x()
    Dim rData As Range
    Application.ScreenUpdating = False
    With Sheets("Detail")
        .UsedRange.Columns(6).Offset(1).Formula = "=COUNTIF(Main!D:D,D2)"
        .AutoFilterMode = False
        .Range("A1").AutoFilter Field:=6, Criteria1:=">0"
        With .AutoFilter.Range
            On Error Resume Next
            Set rData = .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible)
            On Error GoTo 0
            If Not rData Is Nothing Then
            End If
        End With
        .AutoFilterMode = False
    End With
    Application.ScreenUpdating = True
    End Sub

    Open in new window


    Author Closing Comment

    Hi StephenJR,

    Thanks a lot for the solution.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I've recently been in need of an Excel macro that could add a letter before the text on multiple cells in an Excel document. My English is as it is, so I will try explain what it does diffrently. If you have an excel document with 2000 rows an…
    This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
    This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
    This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now