insert page break at each change in column B
Sub InsertBreak_At_Change()
Dim i As Long
For i = Columns(2).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 Wed, 31 Oct 2007 09:57:01 -0700, cbuck
wrote:
It sounds simple enough, but I haven't been able to find any information.
I need to insert a page break at each change of value in column B. For
example:
Column A = Name
Column B = Department
I need to insert a page break every time the department changes.
Any help would be greatly appreciated!
|