Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search and replace by page break
Has anybody got a clue how I can record a search and replace macro which inserts a page break at certain results
Recording it doesn't seem to work. Maybe a visual basic example Thanks in advance Emiel, Holland |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search and replace by page break
Hello Emiel,
Try something like this: Range("A" & iHdrRowNdx & ":Z" & iLastRowNdx).Select With ActiveSheet.UsedRange For RowNdx = iHdrRowNdx + 1 To iLastRowNdx If Range("A" & RowNdx) < Range("A" & RowNdx + 1) Then Range("A" & RowNdx + 1).Select ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell End If Next RowNdx End With Where iHdrRowNdx is your starting point and iLastRowNdx is the ending point. In this example, I compare the current index val w/ the next index value if they are different, then I insert a page break. You could easily change the if statement to your "certain results." I hope this helps some. "Emiel" wrote in message ... Has anybody got a clue how I can record a search and replace macro which inserts a page break at certain results? Recording it doesn't seem to work. Maybe a visual basic example? Thanks in advance. Emiel, Holland |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search and replace by page break
Thanx man, it worked as a miracle
Emiel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 Page Break Adjustments causes a page break each cell | Excel Worksheet Functions | |||
How do I search and replace with a line break? | Excel Discussion (Misc queries) | |||
How do I do page breaks when view menu doesnt page break preview | Excel Discussion (Misc queries) | |||
Is it possible to replace a series of characters by a page break? | Excel Discussion (Misc queries) | |||
adding a new page break to an existing page break | Excel Discussion (Misc queries) |