Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search and replace by page break

Thanx man, it worked as a miracle

Emiel
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Page Break Adjustments causes a page break each cell BKaufman Excel Worksheet Functions 2 September 10th 10 05:02 AM
How do I search and replace with a line break? Impish Excel Discussion (Misc queries) 11 October 14th 08 12:28 AM
How do I do page breaks when view menu doesnt page break preview HeatherF55 Excel Discussion (Misc queries) 0 September 21st 07 04:24 AM
Is it possible to replace a series of characters by a page break? Sue Clay Excel Discussion (Misc queries) 13 May 25th 07 12:32 AM
adding a new page break to an existing page break Edward Letendre Excel Discussion (Misc queries) 1 March 6th 05 09:29 AM


All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"