Thread: Page Breaks
View Single Post
  #2   Report Post  
JulieD
 
Posts: n/a
Default

Hi

a formula can not do this sort of thing. You'll need to use a macro like
the following example:
----
Sub InsertPageBreaks()
ColumnControl = 1 ' column to check for the word total (A=1, B=2 etc -
CHANGE AS NECESSARY)
RowStart = 1 ' starting row

RowStart = RowStart + 1
Do
If Cells(RowStart, ColumnControl).Offset(-1) = "Total" Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(RowStart,
ColumnControl)
Application.StatusBar = "Now adding page break to row " & RowStart
End If
RowStart = RowStart + 1
Loop While Cells(RowStart, ColumnControl) < ""
Application.StatusBar = ""
End Sub
---

to use this code, right mouse click on a sheet tab and choose view code
from the menu choose insert / module
copy & paste the code onto the right hand side of the screen
if any lines go red, click and the end of the line and press the delete
key - this should fix line wrap problems
then use ALT & F11 to switch back to your workbook
choose tools / macro / macros - look for the one that says
"InsertPageBreaks" and press the RUN button

hope this helps
Cheers
JulieD


"fultanio" wrote in message
...
Is it possible to use a formula to put page breaks into a worksheet. ie.
Put
a page break when the word TOTAL appears on the spreadsheet?