View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 97
Default Idiot can't insert page breaks.

Perhaps not an idiot but, I've hit a brick wall trying to insert a page
break with code.



The problem

300 plus rows of data requiring splitting when data in a certain row chages.
On change, insert new line, create a heading summarising data below, format
the heading and insert a page break



Kept getting getting no result trying different method with HPageBreak.
Examples



ActiveSheet.HPageBreaks.Add Befo=Activecell.offset(1)



Selection.offset(1).select

ActiveSheet.HPageBreaks.Add Befo=Activecell

Selection.offset(-1).select





No problem thinks I. Just record a macro and copy code from there.

Steps:

start recorder:

Clear all breaks

Select cell

Insert page break

stop recorder



The recorder generated code but, in pagebreak view I could not see any
break inserted. In print preview, ditto. Started gettiing annoyed by now.
Tried manually dragging breaks into pagebreak view. Voila. Lines appear.
However, the breaks don't appear in print preview.



Just tested code at home. You guessed it. Breaks appear.



What may be causing the lack of breaks in Excel at work? Page setup,
perhaps?

What's the best method to insert a break away from the selected cell?