ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to automate page break (https://www.excelbanter.com/excel-discussion-misc-queries/243047-how-automate-page-break.html)

goodman

how to automate page break
 
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

KC

how to automate page break
 
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





"goodman" wrote:

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


Gord Dibben

how to automate page break
 
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

On Thu, 17 Sep 2009 20:34:01 -0700, goodman
wrote:

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



goodman

how to automate page break
 
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

"Gord Dibben" wrote:

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

On Thu, 17 Sep 2009 20:34:01 -0700, goodman
wrote:

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




Dave Peterson

how to automate page break
 
Columns(4) is the fourth column in the worksheet (Column D).

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

goodman wrote:

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

"Gord Dibben" wrote:

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

On Thu, 17 Sep 2009 20:34:01 -0700, goodman
wrote:

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




--

Dave Peterson

Gord Dibben

how to automate page break
 
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

On Fri, 18 Sep 2009 20:49:01 -0700, goodman
wrote:

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

"Gord Dibben" wrote:

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

On Thu, 17 Sep 2009 20:34:01 -0700, goodman
wrote:

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






All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com