Automatically Printing rows 1-5, then 6-10 etc. pe

2019-04-17 08:27发布

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.

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.

1条回答
劳资没心,怎么记你
2楼-- · 2019-04-17 09:09

This can be easily done with a macro.

  1. Open your excel file and display the sheet containing all of the addresses
  2. Press Alt+F11 to open the Visual Basic Editor
  3. Select Insert > Module to add a new Module
  4. Paste the following code.

    Sub formatSheets()
    
    For i = 5 To 750 Step 5
        ActiveSheet.HPageBreaks.Add Before:=Cells(i + 1, 1)
    Next
    End Sub
    
  5. Select Run > Run Sub/UserForm to run the macro

This will format the sheet to add a page break after every five rows, resulting in 150 sheets with 5 addresses each.

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? :)

查看更多
登录 后发表回答