Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
I am importing a spreadsheet from another application which has the word "Account" appearing multiple times in the first column. I would like to create a Macro that will search for each occurance and insert a page break above the row containing the word. Not sure if this is possible? Any help would be greatly appreciated. Thanks, Neal... |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try the macro
Sub insertBreak() Dim c As Range, s As Long lastRow = ActiveSheet.Cells(65000, "A").End(xlUp).Row Range("A1:A" & lastRow).Select Set c = Selection.Find("Account") Rows(c.Row).PageBreak = xlPageBreakManual End Sub It will insert a break before the first occurence of "Account" on the active sheet "Neal" wrote: Hi, I am importing a spreadsheet from another application which has the word "Account" appearing multiple times in the first column. I would like to create a Macro that will search for each occurance and insert a page break above the row containing the word. Not sure if this is possible? Any help would be greatly appreciated. Thanks, Neal... |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Option Compare Text
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 = "Account" Then Cell.PageBreak = xlPageBreakManual End If Next End Sub Gord Dibben MS Excel MVP On Fri, 24 Oct 2008 12:31:03 -0700, Neal wrote: Hi, I am importing a spreadsheet from another application which has the word "Account" appearing multiple times in the first column. I would like to create a Macro that will search for each occurance and insert a page break above the row containing the word. Not sure if this is possible? Any help would be greatly appreciated. Thanks, Neal... |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Gord,
This worked great! thanks for your help on this. Cheers, Neal... "Gord Dibben" wrote: Option Compare Text 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 = "Account" Then Cell.PageBreak = xlPageBreakManual End If Next End Sub Gord Dibben MS Excel MVP On Fri, 24 Oct 2008 12:31:03 -0700, Neal wrote: Hi, I am importing a spreadsheet from another application which has the word "Account" appearing multiple times in the first column. I would like to create a Macro that will search for each occurance and insert a page break above the row containing the word. Not sure if this is possible? Any help would be greatly appreciated. Thanks, Neal... |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Good to hear.
Thanks for the feedback On Mon, 27 Oct 2008 12:44:03 -0700, Neal wrote: Hi Gord, This worked great! thanks for your help on this. Cheers, Neal... "Gord Dibben" wrote: Option Compare Text 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 = "Account" Then Cell.PageBreak = xlPageBreakManual End If Next End Sub Gord Dibben MS Excel MVP On Fri, 24 Oct 2008 12:31:03 -0700, Neal wrote: Hi, I am importing a spreadsheet from another application which has the word "Account" appearing multiple times in the first column. I would like to create a Macro that will search for each occurance and insert a page break above the row containing the word. Not sure if this is possible? Any help would be greatly appreciated. Thanks, Neal... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count how many times the same word appears in column | Excel Discussion (Misc queries) | |||
Count the number of times specific text appears in a column | Excel Worksheet Functions | |||
Cant move pagebreak in PageBreak View in Excel2003 | Excel Worksheet Functions | |||
INSERT HORIZONTAL PAGEBREAK AFTER EACH LINE IN ENTIRE WORKSHEET . | Excel Worksheet Functions | |||
count the number of times a specific word appears in a column | Excel Worksheet Functions |