Need to edge out the competition for your dream job? Train for certifications today.
for loop1=lbound(array1) to ubound(array1)
for loop2=lbound(array2) to ubound(array2)
if array1(loop1)=array2(loop2) then
Open in new window
Function GETUNIQUE(ByRef Arr1, ByRef Arr2)
If TypeOf Arr1 Is Range Then Arr1 = Arr1.Value2
If TypeOf Arr2 Is Range Then Arr2 = Arr2.Value2
Dim e, x, i As Long
.comparemode = 1
For Each e In Arr1
If Len(e) Then .Item(e) = Empty
For Each e In Arr2
If .exists(e) Then .Item(e) = 1
x = Array(.keys, .items)
For i = 0 To UBound(x(0))
If x(1)(i) = 1 Then .Item(x(0)(i)) = Empty
If .Count Then GETUNIQUE = .keys
MsgBox Join(GETUNIQUE(Range("a2:a6"), Range("b2:b9")), vbLf)
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.