Print auto page breaks

C

Cameron

Can I have a worksheet print with auto page breaks? EX: I have a column with
repeating information sorted in alphabetical order - Names. I want to print
separate pages for each person. Can I have Excel automatically put page
breaks after each grouped set of names? I could do it manually but there are
a lot of names and it would be too time consuming.

Cameron
 
G

Gord Dibben

Sub Insert_PBreak()
Dim OldVal As String
Dim rng As Range
OldVal = Range("A1")
For Each rng In Range("A1:A300") '<< change range
If rng.text <> OldVal Then
rng.PageBreak = xlPageBreakManual
OldVal = rng.text
End If
Next rng
End Sub


Gord Dibben MS Excel MVP
 

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