Inserting Page Breaks

  • Thread starter Thread starter Lady Blue Jay
  • Start date Start date
L

Lady Blue Jay

Is there a formula or function to have the worksheet
automatically insert a manual page break at each change
in a specified column within a row.

For example:

Number Breed Color
001 Retriever Brown
002 Retriever Black
003 Spaniel Spotted
004 Spaniel White

What I need is for the worksheet to automatically enter a
manual page break each time the breed changes in the
second column.

I prefer to do this without using the Access program, but
I am open to discussions about doing the same process in
Access.
 
There's no formula or function, but this macro will work:

Public Sub InsertPageBreaks()
Dim sOld As String
Dim rCell As Range
sOld = Range("B2").Text
Cells.PageBreak = 0
For Each rCell In Range("B2:B" & _
Range("B" & Rows.Count).End(xlUp).Row)
If rCell.Value <> sOld Then
rCell.Offset(0, -1).PageBreak = xlPageBreakManual
sOld = rCell.Text
End If
Next rCell
End Sub
 
Thanks for the response. I am not well versed in macros
outside of the Macro recording function.

How do I bring up the screen necessary to insert the
commands below? I tried Visual Basic Editor, but the
screen is blank.



-----Original Message-----
 
Thanks for the information. I had a feeling this would
take more explanation than contemplated for an e-mail.

Have a Great Day !!!!
 
Back
Top