VBA Code to Insert PAge Breaks

  • The attached file is an example of a monthly report I produce.
    - Please Select Page Break View and notice the Group Name Column and notice where the page break falls.
    - I want the code to keep the client names together. (The name of the client falls under the Group Name). So for example on page 1 you would have all of Ale House, Acfa, AHCI, CHS, BENE H, and BCare. The page break should fall under the Total in Col E.
    - page 2 you would have, Bfuel, C Inst, CFDIS, CM and CO,
    and so on.


    What I have so far:



    What the code is doing: is it works for the 1st page, but nothing after that.

  • Re: VBA Code to Insert PAge Breaks


    Hi jhabey


    I must be missing something as your Code appears to work as expected. I did add a couple lines of Code to set the Top and Bottom Margins to get this distribution...

    Quote

    page 1 you would have all of Ale House, Acfa, AHCI, CHS, BENE H, and BCare
    page 2 you would have, Bfuel, C Inst, CFDIS, CM and CO



    Edit: What version of Excel are you using?

  • Re: VBA Code to Insert PAge Breaks


    Hmmm, that is interesting. I just tested it with the code you provided and sure enough it is working to the way I intended. I wanted to get this code down as it looks more professional when it did not cut off in the middle of the Clients Data. Anyway thanks for providing feedback

  • Re: VBA Code to Insert PAge Breaks


    Hi jhabey


    Glad you got it sorted.


    You posted an xls File...what version of Excel are you using? Code could perhaps be enhanced if Excel 2010 or later.

  • Re: VBA Code to Insert PAge Breaks


    Google on this...works in Excel 2010 and later...will reduce processing time dramatically...


    Code
    Application.PrintCommunication = False

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!