+ Reply to Thread
Results 1 to 7 of 7

Insert Page Breaks Every Nth row, except for the first page.

  1. #1
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Insert Page Breaks Every Nth row, except for the first page.

    Hi, I need a macro to insert a page break after the 44th row, and then every 34 rows from there on out. I found a macro that I thought would do this, but its not working for some reason and I cant seem to figure out why. Every page needs to have a width from Column A to Column M.

    Thanks in advance for any help you can provide.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Insert Page Breaks Every Nth row, except for the first page.

    Maybe try:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: Insert Page Breaks Every Nth row, except for the first page.

    Thanks for the reply!

    When I try that I get:
    Compile Error
    Sub or function not defined

    Then it highlights 'BeforeRange' and Sub testme() turns yellow.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Insert Page Breaks Every Nth row, except for the first page.

    Sorry, change beforerange to before:=range

  5. #5
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: Insert Page Breaks Every Nth row, except for the first page.

    That fixed the error, but now it just seems to set the page breaks to what they would be if you clicked reset all page breaks (between columns J and K and Rows 41 and 42).

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Insert Page Breaks Every Nth row, except for the first page.

    I just double checked and for me it creates them between 44 and 45 and then every 34 rows. Can you post a workbook with the code you are using in it where it is not working?

  7. #7
    Forum Contributor
    Join Date
    08-06-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: Insert Page Breaks Every Nth row, except for the first page.

    It seems to be kind of working. It is setting a horizontal page break where its supposed to, but its not removing the old page breaks.

    Example.xlsm

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 04-29-2013, 08:38 PM
  2. VBA to insert page breaks
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2012, 11:27 PM
  3. Insert Page Breaks
    By NickHubble in forum Excel General
    Replies: 1
    Last Post: 04-05-2010, 08:07 AM
  4. Replies: 1
    Last Post: 03-15-2009, 06:08 PM
  5. Idiot can't insert page breaks.
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 07:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1