|
- Sub test2()
- Dim r%, i%
- Dim arr, brr
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Worksheets("数据")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:f" & r)
- End With
- With Worksheets("准考证")
- ks = .Range("l3")
- js = .Range("m3")
- .Range("a1:i" & .Rows.Count).Clear
- ks = Application.Min(ks, UBound(arr))
- js = Application.Min(js, UBound(arr))
- m = 1
- n = 1
- For i = ks To js
- With .Cells(m, n)
- .Value = "企 业"
- .Resize(1, 4).Merge
- With .Font
- .Size = 16
- .Bold = True
- End With
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- With .Cells(m + 1, n)
- .Value = "银 行 卡"
- .Resize(1, 4).Merge
- With .Font
- .Size = 16
- .Bold = True
- End With
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- .Cells(m + 3, n) = "姓名:"
- .Cells(m + 5, n) = "车间:"
- .Cells(m + 7, n) = "卡号:"
- .Cells(m + 9, n) = "备注:"
- .Cells(m + 11, n) = "注意:"
- .Cells(m + 3, n + 1) = arr(i, 2)
- .Cells(m + 5, n + 1) = arr(i, 3)
- .Cells(m + 7, n + 1) = arr(i, 4)
- With .Cells(m + 11, n + 1)
- .Resize(1, 3).Merge
- .Value = arr(i, 6)
- End With
- With Union(.Cells(m + 3, n + 1), .Cells(m + 5, n + 1), .Cells(m + 7, n + 1), .Cells(m + 9, n + 1), .Cells(m + 11, n + 1), .Cells(m + 11, n + 2))
- With .Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- End With
- n = n + 5
- If n > 6 Then
- n = 1
- m = m + 13
- End If
- Next
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- For i = 27 To r Step 26
- .HPageBreaks.Add Before:=.Rows(i)
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|