View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Yoam69 Yoam69 is offline
external usenet poster
 
Posts: 13
Default How do I insert a page break before each change in the cell conten

Assuming your data has no blank cells in the column you are looking at, this
will get you started:

Do While ActiveCell.Value < xlnull
If ActiveCell.Value < ActiveCell.Offset(1, 0) Then
ActiveWindow.SelectedSheets.HPageBreaks.Add
Befo=ActiveCell.Offset(1, 0)
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

This is just a quick piece of code, but will get you well on your way if you
can do any VB prog at all. Good luck!

"ronda" wrote:

I need to write a Macro or VB Script that will insert page breaks above each
row that contains new contents in a particular cell. One column contains the
work location for our employees in code form (i.e. N002), and page breaks
need to be inserted to separate each work location, so there would need to be
a page break at the point that the Work location code changes from N002 to
N003. This is an extremely time-consuming task that has to be performed on
multiple reports every two weeks. Your help is appreciated!!