ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Compare (https://www.excelbanter.com/excel-worksheet-functions/179639-compare.html)

Srenfro

Compare
 
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??

Otto Moehrbach[_2_]

Compare
 
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

"Srenfro" wrote in message
...
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??





All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com