Results 1 to 3 of 3

Trying to use a Macro to insert a page break every 50 rows starting with row 2.

Threaded View

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2010
    Posts
    1

    Trying to use a Macro to insert a page break every 50 rows starting with row 2.

    I've tried this several times and I just cannot get it to work. I was able to use the below macro in a previous version of this document and it worked fine but in this one, it either doesn't work at all or I get a message saying that I can only enter 1024 page breaks. It is an insanely long spreadsheet but it worked before so I'm just wondering what I'm doing wrong here. Any help is appreciated!

    Here is what I used previously. The previous document did have the same amount of rows (223620).
    Sub AddPB()
    Dim i As Long, LR As Long
    With ActiveSheet
    .ResetAllPageBreaks
    .PageSetup.PrintArea = .UsedRange.Address
    LR = .UsedRange.Rows.Count
    For i = 52 To LR Step 51
    .HPageBreaks.Add Before:=Range("A" & i)
    Next i
    End With
    End Sub
    Last edited by Leith Ross; 02-21-2014 at 02:04 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to insert page break when value in row changes
    By printroom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2013, 06:15 AM
  2. Insert blank row, sum and insert page break macro
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2012, 01:46 AM
  3. Create insert page break macro
    By qtam82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2012, 03:57 AM
  4. Macro To Loop And Insert a Page-break
    By SgtPb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2010, 12:04 PM
  5. [SOLVED] Automatically insert page break every 6 rows in excel doc
    By Icetea in forum Excel General
    Replies: 1
    Last Post: 10-10-2005, 07:05 AM

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