Compare

  • Thread starter Thread starter Srenfro
  • Start date Start date
S

Srenfro

I have an excell workbook that has 2 sheets i use them for part #'s and i
want to have all of the part #s that have the same part # on bolth sheets to
be put on a new sheet sheet 3 is there a way to do this??
 
One way:
Run this macro.
I assumed your part numbers are in Column A in both sheets and you want the
numbers in the third sheet to be in Column A. I also assumed your sheets
are named "One", "Two", and "Three". Change these as necessary. HTH Otto
Sub CopyDups()
Dim rColAOne As Range
Dim rColATwo As Range
Dim Dest As Range
Dim i As Range
Sheets("One").Select
Set rColAOne = Range("A2", Range("A" & Rows.Count).End(xlUp))
With Sheets("Two")
Set rColATwo = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
End With
Set Dest = Sheets("Three").Range("A2")
For Each i In rColAOne
If Not rColATwo.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
Then
i.Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub
 
Back
Top