ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Page Break in the Worksheet (https://www.excelbanter.com/excel-programming/286022-insert-page-break-worksheet.html)

Thang

Insert Page Break in the Worksheet
 
Hello,

I have a list with the column A contains Manager's name
(250 managers, each manager can take ~30 rows), how can I
insert page in the worksheet every time there is change in
the Manager's name.

Many thanks,

Thang

Chip Pearson

Insert Page Break in the Worksheet
 
Thang,

Try something like the following code:

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



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Thang" wrote in message
...
Hello,

I have a list with the column A contains Manager's name
(250 managers, each manager can take ~30 rows), how can I
insert page in the worksheet every time there is change in
the Manager's name.

Many thanks,

Thang




Thang

Insert Page Break in the Worksheet
 
Thank you very very much, it works very good.

Regards,

Thang
-----Original Message-----
Thang,

Try something like the following code:

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



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Thang" wrote in

message
...
Hello,

I have a list with the column A contains Manager's name
(250 managers, each manager can take ~30 rows), how can

I
insert page in the worksheet every time there is change

in
the Manager's name.

Many thanks,

Thang



.



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

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