Inserting Page Breaks

  • Thread starter Thread starter chrisnelsonusa1
  • Start date Start date
C

chrisnelsonusa1

I have a workbook that I am sorting into multiple pages for faxing.
have written a simple equation that puts an "X" in a cell and I woul
like to put a page break at each instance of an "X" in a column.

Is this possible to do automatically?

Chris Nelso
 
I don't know of a way to write it into a formula but, an easy way to do page
breaks is to go to "View", then select "Page Break View". You can then drag
the breaks (the dashed lines) where you want them, then go back to normal
view.
 
Here is one way. The sub "TEST" calls the function that does it. The argument
is an integer representing the column number in which your "X" appears. This
puts the break below the "X", if you want it above the "X" then remove the
"+1":

Sub test()
Call PageBreakVerticalAdd(1)
End Sub

Public Function PageBreakVerticalAdd(argColumn As Integer)
Dim rCell As Range
For Each rCell In ActiveSheet.UsedRange.Columns(argColumn).Rows
If UCase(rCell.FormulaR1C1) = "X" Then
ActiveSheet.HPageBreaks.Add Before:=Cells(rCell.Row + 1, 1)
End If
Next rCell
End Function

HTH/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top