以下代碼完成
設妳的數據在A、B兩列中,把兩列中不重復數據提取到C列
Sub 提取兩列不重復數據1()
Dim d, Temp
Dim r&, r1
Dim arr, arr1
Set d = CreateObject("Scripting.Dictionary")
r = Range("A65536").End(xlUp).Row
r1 = Range("B65536").End(xlUp).Row
arr = Range("A1:A" & r).Value
arr1 = Range("B1:B" & r1).Value
For Each Temp In arr
d(Temp) = 1
Next
For Each Temp In arr1
d(Temp) = 1
Next
Range("C1").Resize(d.Count, 1) = Application.Transpose(d.keys)
End Sub
妳只需要把妳實際的數據列把A、B、C換成妳的實際列標即可,A、B列可增減數據