?
Solved

Crosscheck and Delete Data

Posted on 2011-10-31
2
Medium Priority
?
246 Views
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.
Crosscheck.xls
0
Comment
Question by:Cartillo
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 total points
ID: 37058037
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
            rData.EntireRow.Delete
        End If
    End With
    .AutoFilterMode = False
    .UsedRange.Columns(6).Clear
End With

Application.ScreenUpdating = True

End Sub

Open in new window

0
 

Author Closing Comment

by:Cartillo
ID: 37064444
Hi StephenJR,

Thanks a lot for the solution.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
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.

616 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