I have 2 separate sheets, lets call them sheet A, sheet B. I have data in sheet B which is also in sheet A. I want to find those rows that are equal and remove them from sheet B
Sub CleanDupes()
Dim wsA As Worksheet
Dim wsB As Worksheet
Dim keyColA As String
Dim keyColB As String
Dim rngA As Range
Dim rngB As Range
Dim intRowCounterA As Integer
Dim intRowCounterB As Integer
Dim strValueA As String
keyColA = "A"
keyColB = "B"
intRowCounterA = 1
intRowCounterB = 1
Set wsA = Worksheets("Sheet A")
Set wsB = Worksheets("Sheet B")
Do While Not IsEmpty(wsA.Range(keyColA & intRowCounterA).Value)
intRowCounterB = 1
Set rngA = wsA.Range(keyColA & intRowCounterA)
strValueA = rngA.Value
Do While Not IsEmpty(wsB.Range(keyColB & intRowCounterB).Value
Set rngB = wsB.Range(keyColB & intRowCounterB)
If strValueA = rngB.Value Then
'Code to delete row goes here, but I'm not sure exactly'
'what it is.'
wsB.Rows(intRowCounterB).Delete
intRowCounterB = intRowCounterB - 1
End If
intRowCounterB = intRowCounterB + 1
Loop
intRowCounterA = intRowCounterA + 1
Loop
End Sub
That should get you started.