![]() |
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 |
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 |
Search and replace by page break
Thanx man, it worked as a miracle
Emiel |
All times are GMT +1. The time now is 11:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com