+ Reply to Thread
Results 1 to 3 of 3

Horizontal page breaks

Hybrid View

  1. #1
    Registered User
    Join Date
    05-06-2005
    Posts
    20

    Horizontal page breaks

    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?

  2. #2
    Registered User
    Join Date
    08-20-2003
    Location
    Luton, England
    Posts
    63
    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.
    -----------------------------------------

  3. #3
    Registered User
    Join Date
    05-06-2005
    Posts
    20
    BrianB,

    thanks very much for your help!
    That's excellent and does the trick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1