|
- Sub test()
- Dim arr, brr
- Dim d, d1
- Dim i, j
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- arr = Sheets("2016年入暖客户").UsedRange
- brr = Sheets("2017年客户").Range("a1").CurrentRegion
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- d(arr(i, j)) = ""
- Next
- Next
- For i = 2 To UBound(brr)
- d1(brr(i, 1)) = ""
- If d.exists(brr(i, 1)) Then
- brr(i, 2) = "否"
- Else
- brr(i, 2) = "是"
- End If
- Next
- ReDim crr(1 To UBound(arr) * UBound(arr, 2), 1 To 1)
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If arr(i, j) <> "" Then
- If Not d1.exists(arr(i, j)) Then
- n = n + 1
- crr(n, 1) = arr(i, j)
- End If
- End If
- Next
- Next
- With Sheets("2017年客户")
- .Range("a1").Resize(UBound(brr), UBound(brr, 2)) = brr
- End With
- With Sheets("未巡视或流失客户")
- .Range("a2:b20000").Clear
- .Range("a2").Resize(UBound(crr), 1) = crr
- End With
- End Sub
复制代码 |
|