how to automate page break

G

goodman

I have a sheet for different customers name with total foe each.I want to
print every customer seperate by inserting a page break at the total line. I
did it before manualy
Is any way I can do it automaicaly or with a macro

Your help is greatly appreciated
 
K

KC

goto 'View' menu and click 'Page Break Preview'

once your in page break preview mode, you can right click on the row where
you what to insert the pagebreak and select 'Insert Page Break'

-kc
*Click YES if this helps
 
G

Gord Dibben

Sub Insert_PBreak_Col()
Dim rng As Range
Dim Cell As Range
Set rng = Intersect(ActiveSheet.UsedRange, Columns(4)) 'adjust to suit
For Each Cell In rng
If Cell.text = "Total" Then
Cell.Offset(1, 1).PageBreak = xlPageBreakManual

End If
Next

End Sub


Gord Dibben MS Excel MVP
 
G

goodman

thanks a lot but you didn't show me how to execute this subroutine, I
appreciate it if you give me some instruction, for example what is the
columns(4) is this where the word Total exixt ?

please help with some detail

thanks again Gord
 
G

Gord Dibben

When you asked for a macro I assumed you knew what to do with one.

Columns(4) is Column D and a pagebreak will be inserted below each instance
of the word "Total" in that column.

You have to adjust the column to suit your layout.


Gord
 

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