I wrote the code as the following:intPrevNum = Ubound(PrevProductContact)
intCurNum = Ubound(CurProductContact)
If intPrevNum >= intCurNum Then
For i = 0 To intCurNum
For n = 0 To intPrevNum
If CurProductContact(i) = PrevProductContact(n) Then
PrevProductContact(n) = ""
CurProductContact(i) = ""
i = i + 1
End If
Next
Next
Else ' intPrevNum < intCurNum
Msgbox + intPrevNum
For i = 0 To intPrevNum
Msgbox + intCurNum
For n = 0 To intCurNum
If PrevProductContact(i) = CurProductContact(n) Then
Msgbox + prevProductContact (i)
Msgbox + curProductContact (n)
PrevProductContact(i) = ""
CurProductContact(n) = ""
i = i + 1
End If
Next
Next
End If
but one problem is that if intPrevNum = 1 and intCurNum = 2, then it will show an error msg saying out of range… how to fix the problem?