View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default auto add page breaks

If your data looks like this

east
east
east
west
west
west
etc
etc
etc

This macro will insert a pagebreak at each change of data column A

Sub InsertBreak_At_Change()
Dim i As Long
For i = Selection.Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And Not IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Tue, 26 Sep 2006 09:05:01 -0700, Pam Coleman
wrote:

I import a report from Access into Excel that has grouped together East
Precinct, West Precinct, North Precinct and Central Precinct. Is there a way
I could have excel automatically insert a page break at the end of each
group? I want it all on the same spreadsheet, I just want East on page 1,
west on page 2 and so on. Can this be done?