Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Auto insert page Break when data change.

Status
Not open for further replies.

Airbiskit

Technical User
May 20, 2003
89
GB
Hi,

In excel is it possible to in page break when a value in a column changes.

For example we would like to insert page break after the employee name in Column A changes.

Any ideas would be welcome.

Thanks

Steve
 
Airbiskit: You can certainly do this from a pivot table - would that be worth looking at?

Fee

The question should be [red]Is it worth trying to do?[/red] not [blue] Can it be done?[/blue]
 
Hi,

Try this:

Sub InsertBreaks()
Dim myRange As Range
For Each myRange In Range([A2], [A65536].End(xlUp))
If myRange.Value <> myRange.Offset(1, 0).Value Then
ActiveSheet.HPageBreaks.Add before:=myRange.Offset(1, 0)
End If
Next myRange
End Sub

Dom
 
You can choose to have Page Breaks when doing Data/Subtotal for a list. It will also generate a couple of summary rows as well below the data, which may be useful.

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top