View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Automatic Page Breaks

Brian,
Now I am getting an "Application- defined or Object-defined"error on the
If not rng.value line.
Any thoughts, or am I doing something wrong?

Thanks

"Brian Taylor" wrote:

Sorry I didn't realize you had other questions in there. To have your
print range update automtically do a google search for dynamic named
ranges(setting a named range by using the offset formula).

Also if your criteria is where the data in A changes then you would
change my previous example to:

Dim rng as range
Dim i as integer

i=1

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