View Full Version : add pagebreakes every 50 rows
lior03
01-29-2006, 02:19 AM
hello
suppose i have a data base of 1,000 rows.how can i plant a pagebreak every 50 rows. maybe?
Sub fiftyrows()
Dim i As Integer
For i = 1 To 1000 Step 50
Rows(i).Pagebreak = xlManual
Next i
End Sub
thanks
mdmackillop
01-29-2006, 04:06 AM
Hi Moshe,
Recording the macro will give the basic syntax, and you're there with the rest.
Sub fiftyrows()
Dim i As Integer
For i = 50 To 1000 Step 50
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(i)
Next i
End Sub
TonyJollans
01-29-2006, 04:21 AM
Assuming all your rows are the same height - and if they're not 50 might not fit on every page - what about setting the page margins so that automatic breaks happen every 50 rows?
lior03
01-29-2006, 06:19 AM
hello
an example will be appreciated.
thanks
mdmackillop
01-29-2006, 08:15 AM
Here's an example of Tony's excellent suggestion. It may need some minor adjustment in Print Preview/Margins to suit a particular printer.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.