|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 生成准考证()
Application.ScreenUpdating = False
Set sh = ThisWorkbook.Worksheets("试场安排表")
ar = sh.[a1].CurrentRegion
m = UBound(ar) - 2
If m / 2 = Int(m / 2) Then
sl = m / 2
Else
sl = Int(m / 2) + 1
End If
With Sheets("准考证模板")
r = .Cells(Rows.Count, 5).End(xlUp).Row + 20
.Rows("12:" & r).Delete
.Range("F5:H5,F7,H7,F9,H9,P5:R5,P7,R7,P9,R9") = Empty
m = 12
For i = 1 To sl - 1
.Rows("1:11").Copy .Cells(m, 1)
m = m + 11
Next i
m = 5
For i = 3 To UBound(ar) Step 2
.Cells(m, 6) = ar(i, 6)
.Cells(m + 2, 6) = ar(i, 4)
.Cells(m + 2, 8) = ar(i, 5)
.Cells(m + 4, 6) = ar(i, 2)
.Cells(m + 4, 8) = ar(i, 3)
.Cells(m, 16) = ar(i + 1, 6)
.Cells(m + 2, 16) = ar(i + 1, 4)
.Cells(m + 2, 18) = ar(i + 1, 5)
.Cells(m + 4, 16) = ar(i + 1, 2)
.Cells(m + 4, 18) = ar(i + 1, 3)
m = m + 11
Next i
.Select
End With
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|