Formal to compare a list
Is this what you want?
Sub CompareLists()
Set rnga = Range("List1") ' Contains first list of account numbers
Set rngb = Range("List2") ' Contains second list of account numbers
Set wsin = Worksheets("sheet1") ' input data i.e. contains rows to be copied
Set wsout = Worksheets("sheet2") ' output data (third list)
rw1 = 1
For Each cell In rnga
If Not IsError(Application.Match(cell.Value, rngb, 0)) Then ' matched ....
wsin.Range("A" & cell.Row).EntireRow.Copy Destination:=wsout.Range("A" &
rw1)
rw1 = rw1 + 1
End If
Next
End Sub
[Assume wsin contains one of your account lists].
HTH
"Ange" wrote:
hello all,
I need a formula to compare account numbers in two lists, then to
create a third based on what account numbers match.
The whole row (other fields) need to be brought to the third list as
well.
Thanks you
|