Sub 按钮2_Click()
Set d = CreateObject("scripting.dictionary")
arr = Sheets("报名汇总").UsedRange
Call 删除数据行
brr = Sheets("统计").[a1].Resize(UBound(arr), 7)
r = 2
For j = 3 To UBound(arr)
If arr(j, 2) = "" Then arr(j, 2) = arr(j - 1, 2)
If Not d.exists(arr(j, 2)) Then
r = r + 1
d(arr(j, 2)) = r
End If
x = d(arr(j, 2))
brr(x, 1) = arr(j, 2)
brr(x, 2) = brr(x, 2) + 1
brr(x, 2 + arr(j, 5)) = brr(x, 2 + arr(j, 5)) + 1
If arr(j, 4) = "男" Then
brr(x, 6) = brr(x, 6) + 1
Else
brr(x, 7) = brr(x, 7) + 1
End If
Next j
Sheets("统计").[a1].Resize(r, 7) = brr
End Sub
|