froggyface88
01-04-2014, 09:34 AM
I have a document without a predetermined number of rows that I want to include on each page. I can manually adjust the page break settings to include the right number of rows per page, but I would like to do this as part of my code. Right now, my code is adding an extra page break in the correct place but isn't moving the preset page break. Help? Thanks!
NoGames = 0
Do Until NoGames = 5
If Cells(iRow, 1).Value = "Name" Then
Cells(iRow, 1).Select
NoGames = NoGames + 1
Games = Games + 1
iRow = iRow + 1
Else: iRow = iRow + 1
End If
Loop
iRow = iRow - 2
Games = Games - 1
Rows(iRow).PageBreak = xlPageBreakManual
Loop
NoGames = 0
Do Until NoGames = 5
If Cells(iRow, 1).Value = "Name" Then
Cells(iRow, 1).Select
NoGames = NoGames + 1
Games = Games + 1
iRow = iRow + 1
Else: iRow = iRow + 1
End If
Loop
iRow = iRow - 2
Games = Games - 1
Rows(iRow).PageBreak = xlPageBreakManual
Loop