Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
inserting page breaks for specific data groups
I have a list of data with three columns--I want to automatically insert page
breaks at the end of each group in a cloumn (for example: at change in curriculum code insert page break). Is this possible? If so , how? Ursula |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
inserting page breaks for specific data groups
Ursula
Insert a pagebreak at each change in column A 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 Gord Dibben MS Excel MVP On Fri, 29 Sep 2006 12:44:03 -0700, Ursula Forte <Ursula wrote: I have a list of data with three columns--I want to automatically insert page breaks at the end of each group in a cloumn (for example: at change in curriculum code insert page break). Is this possible? If so , how? Ursula |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
inserting page breaks for specific data groups
Let me preface with "I'm new at using Macros". What if I want to insert a
pagebreak at each change in column B? "Gord Dibben" wrote: Ursula Insert a pagebreak at each change in column A 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 Gord Dibben MS Excel MVP On Fri, 29 Sep 2006 12:44:03 -0700, Ursula Forte <Ursula wrote: I have a list of data with three columns--I want to automatically insert page breaks at the end of each group in a cloumn (for example: at change in curriculum code insert page break). Is this possible? If so , how? Ursula |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
inserting page breaks for specific data groups
Gord's routine works off what you have selected.
But it also inserts a page break in column B. I'm guessing that you want the page break for the whole row: Option Explicit 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).EntireRow.Cells(1) .PageBreak = xlPageBreakManual End With End If Next End Sub cbuck wrote: Let me preface with "I'm new at using Macros". What if I want to insert a pagebreak at each change in column B? "Gord Dibben" wrote: Ursula Insert a pagebreak at each change in column A 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 Gord Dibben MS Excel MVP On Fri, 29 Sep 2006 12:44:03 -0700, Ursula Forte <Ursula wrote: I have a list of data with three columns--I want to automatically insert page breaks at the end of each group in a cloumn (for example: at change in curriculum code insert page break). Is this possible? If so , how? Ursula -- Dave Peterson |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
inserting page breaks for specific data groups
Sub Insert_Pbreak()
Dim OldVal As String Dim rng As Range OldVal = Range("B1") Range("B1").Select Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).Select For Each rng In Selection If rng.Text < OldVal Then rng.PageBreak = xlPageBreakManual OldVal = rng.Text End If Next rng End Sub Gord On Thu, 26 Oct 2006 13:54:02 -0700, cbuck wrote: Let me preface with "I'm new at using Macros". What if I want to insert a pagebreak at each change in column B? "Gord Dibben" wrote: Ursula Insert a pagebreak at each change in column A 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 Gord Dibben MS Excel MVP On Fri, 29 Sep 2006 12:44:03 -0700, Ursula Forte <Ursula wrote: I have a list of data with three columns--I want to automatically insert page breaks at the end of each group in a cloumn (for example: at change in curriculum code insert page break). Is this possible? If so , how? Ursula |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Macro to Copy & Paste | Excel Worksheet Functions | |||
Problem organizing text data into new excel page | Excel Worksheet Functions | |||
Page Breaks--Controlling so no division of certain data | Setting up and Configuration of Excel | |||
Sort pages? | Excel Discussion (Misc queries) | |||
How do I keep page breaks for each page in a sheet without the co. | Excel Discussion (Misc queries) |