Compare Lists
Here's some sample code:
Sub VerifyA()
a = Split("Jan,Feb,Mar,Apr", ",")
b = Split("Jan,Mar,Apr,May", ",")
c = a
For i = LBound(a) To UBound(a)
If -1 = UBound(Filter(b, a(i), True,
vbTextCompare)) Then
c = Filter(a, a(i), False, vbTextCompare)
End If
Next
a = c
MsgBox Join(a) ' will keep Jan,Mar,Apr in a
End Sub
-----Original Message-----
I haven't got the code to hand but you can achieve your
requirement by using the Filter function .. see the VBA
help files for documentation and example. Filter also
copes with case sensitivity.
-----Original Message-----
I could use some help with validating items in a list
with VBA. What
I would like to do is compare List A and List B. If an
item is in
List A but not in List B I would like to delete item
from
List A.
Thanks for any help available.
Regards,
David
.
.
|