View Full Version : Page break macro

03-16-2004, 07:40 AM
I would like to code a macro that makes a page break every time the character - is used in column A in an excel worksheet. How can I do this?

Thanks for your help!

03-16-2004, 03:48 PM
Something like (VB, not PHP)

Sub dash2break()
Cells.Find(What:="-", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
ActiveWindow.SelectedSheets.VPageBreaks.Add Before:=ActiveCell
End Sub