View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Brian Taylor Brian Taylor is offline
external usenet poster
 
Posts: 52
Default Automatic Page Breaks

This line of code puts the first page break at row 43.

Set ActiveSheet.HPageBreaks(1).Location = Range("A43")

You could loop through the cells in column A looking for a criteria to
be met (whatever that is for you) and then set that line to be a page
break. Something like:

Dim i

i=1

For each rng in range("A:A")
If rng.value = "Total" then
Set ActiveSheet.HPageBreaks(i).Location = Range("A" & rng.row)
i = i + 1
End if
Next rng