|
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
brr = Sheets("班级").[c1:h1]
arr = Sheets("班级").UsedRange
For j = 2 To UBound(arr)
If Len(arr(j, 2)) > 0 Then
If Not d.exists(arr(j, 2)) Then
Set d(arr(j, 2)) = CreateObject("scripting.dictionary")
End If
d(arr(j, 2))(j) = ""
End If
Next j
Application.ScreenUpdating = False
r = 1
With Sheets("考场座位表")
.UsedRange.ClearContents
For Each k In d.keys
.Cells(r, 2).Resize(1, 6) = brr
.Cells(r, 9).Resize(1, 6) = brr
c = -1
rx = 1
For Each kk In d(k).keys
If rx = 32 Then
c = 6
rx = 1
End If
For i = 3 To 8
.Cells(rx + r, c + i) = arr(kk, i)
Next i
rx = rx + 1
Next kk
r = r + 31
Next k
End With
Application.ScreenUpdating = True
End Sub
|
|