Compare List A to List B, Return List B Items Not in List A
You need to do:
Dim MyList As Collection
Set MyList = New Collection
Your On Error Resume Next hides that mistake and always useful to comment
out
error handling when you get un-expected results.
RBS
"zwestbrook" wrote in message
...
On Sep 18, 3:13 pm, "PaulD" <nospam wrote:
Have you tried with a collection?
Use the .add method for the first range (List A) into a collection, then
use
the .item method to check if items in List B occur in the collection?
Paul D
Thanks for the tip, Paul...I modified my code a bit but don't know how
to do the comparison...this is not outputting anything:
Sub ListDuplicateVal()
Dim Rng1 As Range
Dim Rng2 As Range
Dim Rng3 As Range
Dim Cell As Range
Dim MyList As Collection
Set Rng1 = Range("A2:A13")
Set Rng2 = Range("B2:B13")
Set Rng3 = Range("D2")
On Error Resume Next
For Each Cell In Rng1
MyList.Add Cell.Value
Next Cell
For Each Cell In Rng2
If Rng2.Cell.Value < MyList.Item(Cell).Value Then
Rng3.Value = Rng2.Cell.Value
Set Rng3 = Rng3.Offset(1, 0)
End If
Next Cell
End Sub
|