genuineblonde
Technical User
I have a worksheet with several columns of data, sorted by column A. Is there a way to insert a page break automatically whenever the value changes in column A?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Columns("B:B").Select
Range("A1:J81").sort Key1:=Range("B2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
For i = 2 To ActiveSheet.UsedRange.Rows.Count
If Cells(i, 2).Value <> Cells((i - 1), 2).Value Then
Cells(i, 1).PageBreak = xlPageBreakManual
End If