自动打印行1-5,然后每页打印6-10等 [英] Automatically Printing rows 1-5, then 6-10 etc. per page
问题描述
我有一个750个家庭地址的列表,一个慈善机构将提供感恩节晚餐。我需要把一个5个家庭的页面交给150个不同的司机。
I have an excel list of 750 family addresses that a charity will be delivering Thanksgiving dinners to. I need to hand a page of 5 families to 150 different drivers.
有没有办法在一页上自动打印1-5行,然后在下一页6-10打印?直到所有750个家庭都被打印?
Is there a way to automatically print rows 1-5 on one page, then 6-10 on the next page etc. until all 750 families are printed?
尝试使用大的底部边距,但不能一致地工作,因为某些行对其他家庭的文字数量较大。
Tried using a large bottom margin but doesn't work consistently as some rows have a larger amount of text about the families that others.
推荐答案
这可以很容易地用宏完成。
This can be easily done with a macro.
- 打开您的Excel文件并显示包含所有
地址的表单 - 按Alt + F11打开Visual Basic编辑器
- 选择插入>模块添加新模块
-
粘贴以下代码。 / p>
- Open your excel file and display the sheet containing all of the addresses
- Press Alt+F11 to open the Visual Basic Editor
- Select Insert > Module to add a new Module
Paste the following code.
Sub formatSheets()
For i = 5 To 750 Step 5
ActiveSheet.HPageBreaks.Add Before:=Cells(i + 1, 1)
Next
End Sub
这将格式化工作表以在每五年后添加一个分页符行,导致150张,每个地址有5个地址。
This will format the sheet to add a page break after every five rows, resulting in 150 sheets with 5 addresses each.
就是说,只有5个地址的150张。在一张纸上将两组五个地址分别手动切割一半就足够了? :)
That being said, that's 150 sheets for just 5 addresses. Would 2 groups of five addresses on one sheet and manually cutting them in half suffice? :)
这篇关于自动打印行1-5,然后每页打印6-10等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!