- Sub test1()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("求助表格")
- arr = .Range("a2:o30")
- ReDim brr(1 To 2, 1 To 7)
- For j = 4 To 10
- brr(1, j - 3) = arr(2, j)
- For i = 3 To UBound(arr)
- If Len(arr(i, 3)) <> 0 Then
- If Len(arr(i, j)) <> 0 Then
- brr(2, j - 3) = brr(2, j - 3) + 1
- End If
- End If
- Next
- Next
- For i = 1 To UBound(brr, 2) - 1
- p = i
- For j = i + 1 To UBound(brr, 2)
- If brr(2, p) < brr(2, j) Then
- p = j
- End If
- Next
- If p <> i Then
- temp = brr(1, i)
- brr(1, i) = brr(1, p)
- brr(1, p) = temp
- temp = brr(2, i)
- brr(2, i) = brr(2, p)
- brr(2, p) = temp
- End If
- Next
- For j = 1 To 3
- .Cells(j + 12, 24) = brr(1, j)
- .Cells(j + 12, 25) = brr(2, j)
- Next
- End With
- End Sub
复制代码 |