ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to insertnew worksheet page (https://www.excelbanter.com/excel-discussion-misc-queries/200106-how-insertnew-worksheet-page.html)

nellellen

how to insertnew worksheet page
 
I have a 4 column worksheet sorted by column A (product name). there are
3000 records in the worksheet. I need to create a page break based on a
change of the value in Collumn A. The ultimate destination of the results
will be insertion into a word document with a page break between each
separate "table".

any assistance onhow to achieve the above is greatly appreciated. My skill
level in excel is moderate beginner...

thank you - Ellen

Gord Dibben

how to insertnew worksheet page
 
Sub Insert_PBreak()
Dim OldVal As String
Dim rng As Range
OldVal = Range("A1")
For Each rng In Range("A1:A3000")
If rng.text < OldVal Then
rng.PageBreak = xlPageBreakManual
OldVal = rng.text
End If
Next rng
End Sub

Note............with 3000 cells to look at, will take a while because
pagebreak insertion is a slow process.


Gord Dibben MS Excel MVP

On Mon, 25 Aug 2008 13:04:02 -0700, nellellen
wrote:

I have a 4 column worksheet sorted by column A (product name). there are
3000 records in the worksheet. I need to create a page break based on a
change of the value in Collumn A. The ultimate destination of the results
will be insertion into a word document with a page break between each
separate "table".

any assistance onhow to achieve the above is greatly appreciated. My skill
level in excel is moderate beginner...

thank you - Ellen




All times are GMT +1. The time now is 04:32 AM.

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