|
学习一下字典,打扰了
Sub test()
arr = [i3].CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 1 To UBound(arr, 2)
If Not d.exists(arr(1, i)) Then
Set d(arr(1, i)) = CreateObject("scripting.dictionary")
End If
For j = 2 To UBound(arr)
d(arr(1, i))(arr(j, i)) = d(arr(1, i))(arr(j, i)) + 1
Next
Next
brr = [a2].CurrentRegion
For i = 2 To UBound(brr)
For j = 2 To UBound(brr, 2)
If d.exists(brr(1, j)) Then
If d(brr(1, j)).exists(brr(i, 1)) Then
brr(i, j) = d(brr(1, j))(brr(i, 1))
Else
brr(i, j) = 0
End If
End If
Next
Next
[a2].CurrentRegion = brr
End Sub |
评分
-
1
查看全部评分
-
|