View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Printing a selection of rows

The following reads the column A and if the contents changes from the
previous row a horizontal page break is inserted.......

Note: You might want to sort the data before this run to ensure each set of
data are together. Also Excel has a limit of 1026 HPageBreaks per sheet.

Sub PagesBrk()
Dim xlr As Long, xr As Long
xlr = Cells(Rows.Count, 1).End(xlUp).Row
For xr = 2 To xlr
If Cells(xr, 1) < Cells(xr - 1, 1) Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Rows(xr)
End If
Next xr
End Sub

--
Cheers
Nigel



"Jbucks007" wrote in
message ...

Thanks for the quick help last time.

I have data in rows by a Rep name. Some Reps have one row some reps
have 4 rows. I would like to print a single page for each with the
data that belongs to them. Such as if a Rep only has one row only one
prints out if another Rep has three then all three print on the same
sheet.

Any thoughts?

thanks,
jason


--
Jbucks007
------------------------------------------------------------------------
Jbucks007's Profile:

http://www.excelforum.com/member.php...o&userid=28661
View this thread: http://www.excelforum.com/showthread...hreadid=486051