Compare Two Lists with VBA

The task of comparing two lists in Excel is a common problem.  The following will isolate the unique values in Column A which are not in Column B and will output the results to column D.  For this VBA procedure to work the data must be side by side in Column A and Column B. 

The List on the right is the unique items from List 1, when comparing List 1 to List 2. This procedure is similar to the article Find Duplicates with VBA.  The solution uses the scripting dictionary to achieve a solution.  The scripting dictionary is a very efficient way to evaluate data with VBA.

Sub Compare1() 'Excel VBA to compare 2 lists.
Dim ar as Variant
Dim var()
Dim i As Long
Dim n As Long

ar=Range("a9").CurrentRegion 'Change Input to suit
ReDim var(1 To UBound(ar, 1), 1 To 1)

With Createobject("scripting.dictionary")
.comparemode=1
For i=1 To UBound(ar, 1)
.Item(ar(i, 2))=Empty
Next
For i=1 To UBound(ar, 1)
If Not .exists(ar(i, 1)) Then
n=n + 1
var(n, 1)=ar(i, 1)
End If
Next
End With
[D9].Resize(n).Value=var 'Change output to suit

End Sub

The following Excel file shows a practical example of this VBA procedure.