View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
CST[_2_] CST[_2_] is offline
external usenet poster
 
Posts: 14
Default 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