|
- Sub 统计()
- Dim i%, j%, arr
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("数据库")
- arr = .[a2].CurrentRegion
- For i = 3 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- d(arr(i, j) & "|" & arr(1, j)) = ""
- Next
- Next
- End With
- With Sheets("统计表")
- arr = .[b2:hl181]
- For i = 2 To UBound(arr)
- For j = 2 To UBound(arr, 2)
- s = arr(i, 1) & "|" & arr(1, j)
- If d.exists(s) Then
- arr(i, j) = 1
- Else
- arr(i, j) = 0
- End If
- Next
- Next
- .[b2].Resize(UBound(arr, 1), UBound(arr, 2)) = arr
- End With
- Set d = Nothing
- End Sub
复制代码 |
|