View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Inserting pagebreaks into an Excel Worksheet

Sub InsertBreak_At_Change()
Dim i As Long
For i = Selection.Rows.Count To 1 Step -1
If Selection(i).Row = 1 Then Exit Sub
If Selection(i) < Selection(i - 1) And Not IsEmpty _
(Selection(i - 1)) Then
With Selection(i)
.PageBreak = xlPageBreakManual
End With
End If
Next
End Sub

Select the 3900 + rows and run the above.


Gord Dibben Excel MVP

On Tue, 17 May 2005 15:36:04 -0700, cs_vision
wrote:

The problem is I have over 3900 records in my database and I need to insert
manual pagebreaks for each change unit numbers. There is a limitation with
pagebreaks.

"Dave Peterson" wrote:

I find the easiest thing to do is to use Data|Subtotals.

There's an option to put each group on its own page--and I get subtotals on top
of it!

cs_vision wrote:

Can I automatically insert pagebreaks at certain points in a Excel Worksheet.
I have a worksheet that contains a column where there are unit numbers and I
need to insert a pagebreak whereever the unit number changes.


--

Dave Peterson