|
- Sub 座位表()
- Application.ScreenUpdating = False
- Set ang = Sheet1.[a1].CurrentRegion
- Set d = CreateObject("scripting.dictionary"): d(ang(2, 5).Value) = 1: bj = 2
- With Sheet2: .Range("A1:Y1000").ClearContents: m = 1: .Rows("1:40").RowHeight = 18.25
- For i = 2 To ang.End(xlDown).Row
- A = (m + bj - 1) Mod bj: n = 5 * ((m + bj - 1 - A) / bj - 1) + 1: j = A * 5 + 1
- .Cells(n, j).Offset(0, 0) = "姓名": .Cells(n, j).Offset(0, 1) = ang(i, 4).Value
- .Cells(n, j).Offset(1, 0) = "年级": .Cells(n, j).Offset(1, 1) = ang(i, 2).Value
- .Cells(n, j).Offset(1, 2) = "班级": .Cells(n, j).Offset(1, 3) = ang(i, 3).Value
- .Cells(n, j).Offset(2, 0) = "考场号": .Cells(n, j).Offset(2, 1) = ang(i, 5).Value
- .Cells(n, j).Offset(2, 2) = "座位号": .Cells(n, j).Offset(2, 3) = ang(i, 6).Value
- .Cells(n, j).Offset(3, 0) = "考生号": .Cells(n, j).Offset(3, 1) = "'" & ang(i, 7).Value
- m = m + 1
- If ang(i + 1, 5).Value <> Application.Index(d.KEYS, d.Count) Then
- maxro = .Cells(Rows.Count, "a").End(xlUp).Row + 1
- If maxro > 40 Then
- .Rows("1:5").Copy
- .Rows("41:" & maxro).PasteSpecial Paste:=xlPasteFormats, _
- Operation:=xlNone, SkipBlanks:=False, Transpose:=False
- End If
- .PrintOut Copies:=1: d(ang(i + 1, 5).Value) = 1
- If maxro > 40 Then .Rows("41:" & maxro).Delete Shift:=xlUp
- .Range("A1:Y1000").ClearContents: m = 1
- End If
- Next i: End With: ang = ""
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|