Sub CheckDiff()
    Dim r%, i%
    Dim arr, brr
    Dim d As Object
    Set d = CreateObject("scripting.dictionary")
    With Worksheets("sheetName")
        r = .Cells(.Rows.Count, 1).End(xlUp).Row
        arr = .Range("a2:a" & r)
        For i = 1 To UBound(arr)
          d(arr(i, 1)) = ""
        Next
        r = .Cells(.Rows.Count, 2).End(xlUp).Row
        arr = .Range("b2:b" & r)
        ReDim brr(1 To UBound(arr), 1 To 1)
        m = 0
        For i = 1 To UBound(arr)
          If Not d.exists(arr(i, 1)) Then
            m = m + 1
            brr(m, 1) = arr(i, 1)
          End If
        Next
        .Range("c2").Resize(m, 1) = brr
    End With
End Sub

参考:http://club.excelhome.net/thread-1383635-1-1.html

更新于 阅读次数

请我喝[茶]~( ̄▽ ̄)~*

Jalen Chu 微信支付

微信支付

Jalen Chu 支付宝

支付宝

Jalen Chu 公众号

公众号