Excel Printing

L

Liege

Is there a way to print a worksheet by every change in record. For example:
in column "A" are all customer names (all other columns relate to that
customer info) Is there a way to print a new page after Excel recognizes a
change in every "record" or customer name. This would print a separate page
per customer.
 
J

JE McGimpsey

Liege said:
Is there a way to print a worksheet by every change in record. For example:
in column "A" are all customer names (all other columns relate to that
customer info) Is there a way to print a new page after Excel recognizes a
change in every "record" or customer name. This would print a separate page
per customer.

One way:

Public Sub PrintPerRecord()
Dim i As Long
With Sheets("Sheet1")
.ResetAllPageBreaks
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 2 Step -1
If .Cells(i, 1).Value <> .Cells(i - 1, 1).Value Then _
.HPageBreaks.Add before:=.Cells(i, 1)
Next i
End With
End Sub

Change the Sheet name to suit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top