ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   coditional Page Break (https://www.excelbanter.com/excel-worksheet-functions/218719-coditional-page-break.html)

j4m3sc

coditional Page Break
 
Hi

I have a problem where i need to use automated page breaks on excel.

I'd like a page break each time the word "accounting" appears in Column A.
To make my problem even harder for me is that there are blank cells in
Column A.

I know VGA code will be needed but cannot do this myself.

Please help

Suleman Peerzade[_2_]

coditional Page Break
 
Hi,

Try this
http://www.mvps.org/dmcritchie/excel/pagebrks.htm
--
_______________________
Click "Yes" if it helps
________
Thanks
Suleman Peerzade


"j4m3sc" wrote:

Hi

I have a problem where i need to use automated page breaks on excel.

I'd like a page break each time the word "accounting" appears in Column A.
To make my problem even harder for me is that there are blank cells in
Column A.

I know VGA code will be needed but cannot do this myself.

Please help


Gord Dibben

coditional Page Break
 
Sub Insert_PBreak_Col()
Dim rng As Range
Dim Cell As Range
Set rng = Intersect(ActiveSheet.UsedRange, Columns(1))
For Each Cell In rng
If Cell.Text = "accounting" Then
Cell.Offset(1, 1).PageBreak = xlPageBreakManual
End If
Next
End Sub

Will insert a pagebreak below the word "accounting"

If you want it above, change the line

Cell.Offset(1, 1).PageBreak = xlPageBreakManual to

Cell.PageBreak = xlPageBreakManual


Gord Dibben MS Excel MVP


On Mon, 2 Feb 2009 05:02:03 -0800, j4m3sc
wrote:

Hi

I have a problem where i need to use automated page breaks on excel.

I'd like a page break each time the word "accounting" appears in Column A.
To make my problem even harder for me is that there are blank cells in
Column A.

I know VGA code will be needed but cannot do this myself.

Please help



Ashish Mathur[_2_]

coditional Page Break
 
Hi,

A non macro approach would be using the Data Subtotal feature. First of
all sort column A. Then highlight the range and navigate to Data
Subtotal. Provide the relevant inputs and check the box for "Create page
breaks"

Hope this helps.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"j4m3sc" wrote in message
...
Hi

I have a problem where i need to use automated page breaks on excel.

I'd like a page break each time the word "accounting" appears in Column A.
To make my problem even harder for me is that there are blank cells in
Column A.

I know VGA code will be needed but cannot do this myself.

Please help




All times are GMT +1. The time now is 01:13 PM.

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