|
- Option Explicit
- Sub l()
- Dim d As Object
- Dim arr As Variant, brr As Variant
- Dim i As Integer, j As Integer
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheet2.UsedRange.Value
- brr = Sheet1.Range("a1:b" & Sheet1.[a65536].End(3).Row).Value
- For i = 2 To UBound(arr)
- d(arr(i, 1)) = arr(i, 2)
- Next
- For i = 2 To UBound(brr)
- For j = 2 To UBound(arr)
- If InStr(brr(i, 1), arr(j, 1)) Then
- brr(i, 2) = d(arr(j, 1))
- Exit For
- End If
- Next
- Next
- Set d = Nothing
- Sheet1.[a1].Resize(UBound(brr), 2).Value = brr
- End Sub
复制代码 |
|