|
- Sub qs()
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet1.UsedRange.Value
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If s <> Empty Then
- If Not dic.exists(s) Then
- dic(s) = arr(i, 2)
- End If
- End If
- Next
- k = dic.items
- brr = Sheet2.Range("a1").CurrentRegion.Value
- ReDim crr(1 To UBound(brr), 1 To 2)
- For i = 2 To UBound(brr)
- s = brr(i, 1)
- If dic.exists(s) Then
- m = m + 1
- crr(m, 1) = s: crr(m, 2) = dic(s)
-
- End If
- Next
- Sheet3.Range("a2").Resize(m, 2) = crr
- Set dic = Nothing
- End Sub
复制代码 |
|