Idiot can't insert page breaks.

S

Steve

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 Before:=Activecell.offset(1)



Selection.offset(1).select

ActiveSheet.HPageBreaks.Add Before:=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?
 
S

Steve

Idiot recovers the power of thought:

With ActiveSheet.PageSetup
....
.FitToPagesTall = False
....
End With
 

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

Top