page break in Excel

D

Dillon

Doe anyone know if there is a way to create page breaks
automatically everytime the information in a certain
field changes? I use Excel to create timesheet records
for part-time employees and I have to manually create a
page break everytime the employee changes. Thanks

Frank
 
S

Steve Smallman

Frank,

have you looked at the Subtotal function? this will allow you to
automatically add a total to your hours worked column for each employee, and
insert a page break below the employee name.

Steve
 
P

Paul B

Frank, this macro will put a page break when the data in column A changes

Sub InsertBreaks()
Set rng = Range(Cells(2, 1), _
Cells(Rows.Count, 1).End(xlUp))
For Each cell In rng
If Trim(cell.Value) <> _
Trim(cell.Offset(-1, 0).Value) Then
ActiveSheet.HPageBreaks.Add cell
End If
Next
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 

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