|
Sub zkz()
Application.ScreenUpdating = False
With Sheets("1、学生信息")
rs = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a1:i" & rs)
End With
With Sheets("准考证")
ws = .Cells(Rows.Count, 1).End(xlUp).Row + 23
.Rows("22:" & ws).Delete
.Range("b3:b16,f3:f16") = Empty
t = UBound(ar) - 2
If t / 2 = Int(t / 2) Then
y = Int(t / 2)
Else
y = Int(t / 2) + 1
End If
m = 22
For i = 1 To y
.Rows("1:21").Copy .Cells(m, 1)
m = m + 21
Next i
m = 8
For i = 2 To UBound(ar) Step 2
.Cells(m, 2) = ar(i, 2)
.Cells(m + 2, 2) = ar(i, 7)
.Cells(m + 4, 2) = ar(i, 4)
.Cells(m + 6, 2) = ar(i, 6)
.Cells(m + 7, 2) = ar(i, 5)
.Cells(m + 8, 2) = ar(i, 9)
If i = UBound(ar) Then GoTo 10
.Cells(m, 6) = ar(i + 1, 2)
.Cells(m + 2, 6) = ar(i + 1, 7)
.Cells(m + 4, 6) = ar(i + 1, 4)
.Cells(m + 6, 6) = ar(i + 1, 6)
.Cells(m + 7, 6) = ar(i + 1, 5)
.Cells(m + 8, 6) = ar(i + 1, 9)
m = m + 21
10:
Next i
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|