-
Solved: Page break at each change in customer
This is the code I am trying:
[VBA]For i = finalRow To 2 Step -1
If Cells(i, "A") = Cells(i, "A").Offset(-1, 0) Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(i, "A")
Else
End If
Next[/VBA]
It isn't giving me an error but it isn't inserting the page break either.
-
It puts thousands in for me, you are testing wrongly.
If you get none, what is in finalrow?
The code should be
[vba]
For i = finalrow To 2 Step -1
If Cells(i, "A").Value <> Cells(i - 1, "A").Value Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(i, "A")
End If
Next
[/vba]
-
Thank you that worked perfectly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules