|
- Sub tj()
- arr = [a1].CurrentRegion
- Set d = CreateObject("scripting.dictionary")
- Dim brr(100001 To 100100, 1 To 10)
- For i = 2 To UBound(arr)
- brr(arr(i, 1), 1) = arr(i, 2)
- Next
- For j = 7 To 11 Step 2
- arr = Cells(1, j).CurrentRegion
- c = (j - 3) / 2
- For i = 2 To UBound(arr)
- brr(arr(i, 1), c) = 1
- Next
- Next
-
- For i = LBound(brr) To UBound(brr)
- lx = brr(i, 1)
- If brr(i, 2) = 1 Then d("一号桌" & lx) = d("一号桌" & lx) + 1
- If brr(i, 3) = 1 Then d("二号桌" & lx) = d("二号桌" & lx) + 1
- If brr(i, 4) = 1 Then d("三号桌" & lx) = d("三号桌" & lx) + 1
- If brr(i, 2) + brr(i, 3) + brr(i, 4) = 3 Then
- d("一二三号桌" & lx) = d("一二三号桌" & lx) + 1
- ElseIf brr(i, 2) + brr(i, 3) + brr(i, 4) = 2 Then
- If brr(i, 2) + brr(i, 3) = 2 Then d("一二号桌" & lx) = d("一二号桌" & lx) + 1
- If brr(i, 2) + brr(i, 4) = 2 Then d("一三号桌" & lx) = d("一三号桌" & lx) + 1
- If brr(i, 3) + brr(i, 4) = 2 Then d("二三号桌" & lx) = d("二三号桌" & lx) + 1
- End If
- Next
- For Each x In d.keys
- s = s & Chr(10) & x & ":" & d(x) & "人"
- Next
- MsgBox Mid(s, 2)
- End Sub
复制代码 |
|