I need to create third array from difference of two arrays, I simply can not get the logic of this
The correct third array v3
would be (from the code below) v3 = (Carol, Ted, Thor, Freya)
Thanks
Sub MatchArrays()
Dim v1, v2, v3
Dim i As Long, j As Long
v1 = Array("Bob", "Carol", "Ted", "Alice", "Thor", "Freya")
v2 = Array("Bob", "Carol")
ReDim v3(LBound(v1) To Abs(UBound(v1) - UBound(v2)))
For i = LBound(v1) To UBound(v1)
For j = LBound(v2) To UBound(v2)
If InStr(1, v1(i), v2(j)) Then
v3(i) = v1(i)
Exit For
End If
Next j
MsgBox v3(i)
Next i
End Sub