Page break on condition

DaKen

Board Regular
Joined
Feb 18, 2002
Messages
55
Is there a way to make a page break based on the change in a particular column?
I have a list of sales info that changes each time I refresh it and I need the worksheet to set the page breaks automatically for each salesman. Salesman# is one of the columns and the data is sorted on that column.

Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You could also try this macro. Set c to the columnno for #salesman.

Sub Pages()
c = 1 '** insert the columnno you want to use for pagebreaks **
x = Application.WorksheetFunction.CountA(Columns(c))
For i = 2 To x
If Cells(i, c) <> Cells(i - 1, c) Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(i, 1)
End If
Next
End Sub

regards Tommy
 
Upvote 0
I couldn't get either one to work. On the 2nd option, I replaced the 1 with the column # of the salesmen# (13 for coumn "M")
I ran the macro and it did nothing.

I don't know?
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,764
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top