printing a list

S

sn

Hello, i need help:
I have a list that contains all the invoices of the
customers. Note: a customer might have more than one
invoice.
I need to print this list, but eatch customer in a
separate page.

Thank you,
SN
 
F

Frank Kabel

Hi
could you provide some more details about the layout of this sheet. One
way could be to use a macro which inserts manual pagebreaks.

E.g. try the following macros (inserts a pagebreak if the value in
column A changes). Adapt this to your needs

Option Explicit
Sub insert_pagebreak()
Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "A").Value <> _
Cells(row_index + 1, "A").Value Then
ActiveSheet.HPageBreaks.Add Before:= _
Cells(row_index + 1, "A")
End If
Next
End Sub

Sub remove_them()
ActiveSheet.ResetAllPageBreaks
End Sub
 

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