Quote from Blue_HornetDisplay More
Hi, Andrey, and welcome to the site.
I don't know of a way to do what you want through formatting. I do have a macro that will do it for you ...
This macro looks for the word "Hello" (by itself, if you want it to find "Hello, World" or "Hello, Bob" and treat them the same, the code would require modification) in the working cells in Column A:A and, when found, inserts a PageBreak at that point.
You can look up elsewhere on this site and find out how to paste code into a module.
Sub InsertBreaks() ' Insert PageBreaks in A:A wherever 'Hello' appears Application.ScreenUpdating = False ' Set the area to be worked Set Workrange = Columns("A:A").EntireColumn Set Workrange = Intersect(Workrange.Parent.UsedRange, Workrange) CellCount = Workrange.Count ' Remove existing PageBreaks from bottom to top For myBreaks = ActiveSheet.HPageBreaks.Count To 1 Step -1 ActiveSheet.HPageBreaks(myBreaks).Delete Next myBreaks ' Insert PageBreaks at "Hello", starting at the top of 'WorkRange' _ and working down to the bottom For myCounter = Workrange.Row To Workrange.Row + CellCount If Cells(myCounter, 1) = "Hello" Then ActiveWindow.SelectedSheets.HPageBreaks.Add before:=Cells(myCounter, 1) End If Next myCounter Application.ScreenUpdating = True End Sub
hi, my case is : for everything the word= " Register", needed insert a page break, what ? the document header, is initiate " Register", consider spaces...
treat the text document imported, format no appropriate ...