|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
方法比较笨
Sub test()
Dim dic1 As Object, dic2 As Object, arr, i As Integer, brr, crr()
Dim n As Integer
Set dic1 = CreateObject("scripting.dictionary")
Set dic2 = CreateObject("scripting.dictionary")
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
dic1(arr(i, 1)) = ""
Next i
brr = [c1].CurrentRegion
For i = 2 To UBound(brr)
dic2(brr(i, 1)) = ""
Next i
x = dic1.keys
y = dic2.keys
ReDim crr(0 To UBound(x) + UBound(y))
For i = 0 To UBound(x)
If dic2.exists(x(i)) = False Then
crr(n) = x(i)
n = n + 1
End If
Next i
For i = 0 To UBound(y)
If dic1.exists(y(i)) = False Then
crr(n) = y(i)
n = n + 1
End If
Next i
Range("f2").Resize(n, 1) = Application.Transpose(crr)
End Sub
|
|