View Single Post
 
Old 03-20-2012, 06:13 AM
Catalin.B Catalin.B is offline Windows Vista Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

You can place a page break when the cell value in column 1 changes.
Code:
Option Explicit
Sub MakePageBreaks()
Dim i As Integer
ActiveSheet.ResetAllPageBreaks
Application.ScreenUpdating = False

For i = 2 To 800
If ActiveSheet.Cells(i, 1).Text <> ActiveSheet.Cells(i + 1, 1).Text Then
ActiveSheet.Cells(i + 1, 1).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add before:=ActiveCell
End If
Next
Application.ScreenUpdating = True
End Sub
Reply With Quote