就用一个较直观方法吧, 好理解.
1. 用A的每个值查B数组, 没找到就填入C
2. 同理, B查A, 生成D. (程序流程是一样的).
Option Base 1
Dim c() As String, cn As Integer, found As Boolean
cn = 0
For i = LBound(a) To UBound(a)
found = False
For j = LBound(b) To UBound(b)
If b(j) = a(i) Then
found = True
Exit For
End If
Next
If Not found Then
cn = cn + 1
ReDim Preserve c(cn)
c(cn) = a(i)
End If
Next