代码如下。。。
Function test(rng As Range, rg As Range)
Dim Arr, Brr
Dim Dic As Object
Dim i, j, m, n As Long
Arr = rng
Set Dic = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(Arr)
For j = 3 To UBound(Arr, 2)
Dic(Arr(i, 1) & Arr(i, 2) & Arr(1, j)) = Arr(i, j)
Next j
Next i
Brr = rg
For m = 2 To UBound(Brr)
For n = 3 To UBound(Brr, 2)
Brr(m, n) = Dic(Brr(m, 1) & Brr(m, 2) & Brr(1, n))
Next n
Next m
test = Brr
Set Dic = Nothing
End Function
Function suju(rng As Range, rg As Range)
Dim Arr, Brr
Dim Dic As Object
Dim i, j, m, n As Long
Arr = rng
Set Dic = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(Arr)
For j = 3 To UBound(Arr, 2)
Dic(Arr(i, 1) & Arr(i, 2) & Arr(1, j)) = Arr(i, j)
Next j
Next i
suju = Dic(Cells(rg.Row, 1) & Cells(rg.Row, 2) & Cells(1, rg.Column))
Set Dic = Nothing
End Function
|