|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- With Worksheets("sheet2")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:d" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 2) & "+" & arr(i, 3)
- d1(xm) = arr(i, 4)
- Next
- For j = 7 To 13 Step 6
- r = .Cells(.Rows.Count, j).End(xlUp).Row
- arr = .Cells(2, j).Resize(r - 1, 3)
- For i = 1 To UBound(arr)
- xm = arr(i, 1) & "+" & arr(i, 2)
- d2(xm) = arr(i, 3)
- Next
- Next
- End With
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:g" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 2) & "+" & arr(i, 3)
- If d1.exists(xm) Then
- arr(i, 4) = d1(xm)
- End If
- xm = arr(i, 5) & "+" & arr(i, 6)
- If d2.exists(xm) Then
- arr(i, 7) = d2(xm)
- End If
- Next
- .Range("a2:g" & r) = arr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|