Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2003
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Page break macro

    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!

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like (VB, not PHP)
    PHP Code:
    Sub dash2break()
        
    Cells.Find(What:="-"After:=ActiveCellLookIn:=xlFormulasLookAt:= _
            xlPart
    SearchOrder:=xlByRowsSearchDirection:=xlNextMatchCase:=False_
            
    .Activate
        ActiveWindow
    .SelectedSheets.HPageBreaks.Add Before:=ActiveCell
        ActiveWindow
    .SelectedSheets.VPageBreaks.Add Before:=ActiveCell
    End Sub 
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •