- Private Sub CommandButton6_Click()
- Dim Arr1, Arr2, i&, Myr&, l1, l2, scl3, d
- Set d = CreateObject("Scripting.Dictionary")
- l1 = TextBox1.Text
- l2 = TextBox2.Text
- scl3 = TextBox3.Text
- Cells(1, scl3).Resize(500, 1).ClearContents
- Myr = Cells(65536, l1).End(xlUp).Row
- Arr1 = Cells(2, l1).Resize(Myr - 1)
- Myr = Cells(65536, l2).End(xlUp).Row
- Arr2 = Cells(2, l2).Resize(Myr - 1)
- For i = 1 To UBound(Arr1)
- d(Arr1(i, 1)) = ""
- Next
- n = 1
- For i = 1 To UBound(Arr2)
- If Not d.exists(Arr2(i, 1)) Then
- n = n + 1
- Cells(n, scl3) = Arr2(i, 1)
- End If
- Next
- Cells(1, scl3) = "差异列"
- End Sub
复制代码 |