View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Help! How do I insert a manual page break on a change in cell co

Hi,

Right click your sheet tab, view code and paste this in and run it

Sub marine()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A2:A" & lastrow)
For Each c In myrange
c.Select
If c.Value < c.Offset(-1, 0).Value Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell
End If
Next
End Sub

Mike

"Al Dykes" wrote:



If I sort spreedshet on Column A, I want to print a paper report that
starts a new page whenever the contents of col. A changes.

How?

TIA.

--
Al Dykes
News is something someone wants to suppress, everything else is advertising.
- Lord Northcliffe, publisher of the Daily Mail