|
- Sub test0()
- Dim ar, br, Dict As Object
- Dim i As Long, posRow As Long, posCol As Long
- Set Dict = CreateObject("Scripting.Dictionary")
- With Sheet2.Range("A1").CurrentRegion
- .Offset(1, 1).ClearContents
- ar = .Value
- End With
- For i = 2 To UBound(ar)
- Dict.Add ar(i, 1), i
- Next
- For i = 2 To UBound(ar, 2)
- Dict.Add ar(1, i), i
- Next
- br = Sheet1.Range("A1").CurrentRegion.Value
- For i = 2 To UBound(br)
- If Dict.Exists(br(i, 2)) Then
- posRow = Dict(br(i, 2))
- If Dict.Exists(br(i, 1)) Then
- posCol = Dict(br(i, 1))
- ar(posRow, posCol) = ar(posRow, posCol) + 1
- End If
- End If
- Next
- Sheet2.Range("A1").Resize(UBound(ar), UBound(ar, 2)) = ar
- Set Dict = Nothing
- Beep
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|