|
再试试!以后有问题请回复我,不然没有提醒哈。。。{:1012:}
- Sub test()
- Dim ar, br
- Dim i As Long, j As Long
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- On Error Resume Next
- Sheets("结果").Delete
- On Error GoTo 0
- Sheets("模板").Copy , Sheets(Sheets.Count)
- ActiveSheet.Name = "结果"
- ar = Sheets("表2").Cells(1, 1).CurrentRegion
- For i = 2 To UBound(ar)
- j = i * 19 - 18
- Range("A1:I16").Copy Cells(j, 1)
- Cells(j, 7) = ar(i, 6)
- Cells(j + 1, 2) = ar(i, 1)
- Cells(j + 4, 2) = ar(i, 7)
- Cells(j + 4, 4) = ar(i, 8)
- Cells(j + 4, 6) = ar(i, 3) & ar(i, 4) & "件"
- Cells(j + 8, 2) = ar(i, 5)
- Cells(j + 10, 2) = ar(i, 2)
- ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(j, 1)
- Next i
- Rows("1:19").Delete
- ActiveSheet.PageSetup.PrintArea = "$A$1:$I$" & j - 1
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|