Is there a way of inserting a Horizontal page break before (one row before) a certain Piece of known text in a cell? Can a macro be done for this task?
Is there a way of inserting a Horizontal page break before (one row before) a certain Piece of known text in a cell? Can a macro be done for this task?
Something like this :-
![]()
'================================================== '- FIND & INSERT A PAGEBREAK DEPENDING ON CONTENT '- Brian Baulsom January 2005 '-------------------------------------------------- Sub Do_PageBreak() Dim MyFind As Variant Dim FoundCell As Object Dim FoundRow As Long '---------------------------------------------------------- MyFind = _ InputBox("Please insert value to find.", " FIND") If MyFind = "" Then End '----------------------------------------------------------- Set ws = ActiveSheet Set FoundCell = ws.Cells.Find(what:=MyFind, MatchCase:=False) If FoundCell Is Nothing Then MsgBox (MyFind & " NOT FOUND.") Else FoundRow = FoundCell.Row ws.HPageBreaks.Add Before:=ws.Range("A" & FoundRow) MsgBox ("Done") End If End Sub
Regards
BrianB
Most problems are caused by starting from the wrong place.
Use a cup of coffee to speed up all Windows processes.
It's easy until you know how.
-----------------------------------------
BrianB,
thanks very much for your help!
That's excellent and does the trick
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks