+ Reply to Thread
Results 1 to 4 of 4

insert page break

  1. #1
    ruben via OfficeKB.com
    Guest

    insert page break

    Hi all,

    I have an excel sheet where hundreds of invoices are found and would like to
    insert page breaks after the word 'Total' is being displayed. Is that
    possible?

    Thks in advance

    --
    Message posted via http://www.officekb.com

  2. #2
    Ardus Petus
    Guest

    Re: insert page break

    Try this:

    HTH
    --
    AP

    '---------------
    Sub InsertPB()
    Dim rTotal As Range
    Dim sFirstFound As String
    With ActiveSheet
    Set rTotal = .UsedRange.Find( _
    what:="Total", _
    lookat:=xlWhole)
    If Not rTotal Is Nothing Then
    sFirstFound = rTotal.Address
    Do
    .HPageBreaks.Add before:=rTotal.Offset(1, 0)
    Set rTotal = .UsedRange.FindNext(after:=rTotal)
    Loop Until rTotal.Address = sFirstFound
    End If
    End With
    End Sub
    '---------------
    "ruben via OfficeKB.com" <u21729@uwe> a écrit dans le message de news:
    6012de74a9ca8@uwe...
    > Hi all,
    >
    > I have an excel sheet where hundreds of invoices are found and would like
    > to
    > insert page breaks after the word 'Total' is being displayed. Is that
    > possible?
    >
    > Thks in advance
    >
    > --
    > Message posted via http://www.officekb.com




  3. #3
    ruben via OfficeKB.com
    Guest

    Re: insert page break

    Ardus Petus wrote:
    >Try this:
    >
    >HTH
    >--
    >AP
    >
    >'---------------
    >Sub InsertPB()
    > Dim rTotal As Range
    > Dim sFirstFound As String
    > With ActiveSheet
    > Set rTotal = .UsedRange.Find( _
    > what:="Total", _
    > lookat:=xlWhole)
    > If Not rTotal Is Nothing Then
    > sFirstFound = rTotal.Address
    > Do
    > .HPageBreaks.Add before:=rTotal.Offset(1, 0)
    > Set rTotal = .UsedRange.FindNext(after:=rTotal)
    > Loop Until rTotal.Address = sFirstFound
    > End If
    > End With
    >End Sub
    >'---------------
    >> Hi all,
    >>

    >[quoted text clipped - 4 lines]
    >>
    >> Thks in advance


    Thanks AP,

    Works just fine. U'r a genius.

    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200605/1

  4. #4
    Ardus Petus
    Guest

    Re: insert page break

    Thanks for the feedback!

    Cheers,
    --
    AP

    "ruben via OfficeKB.com" <u21729@uwe> a écrit dans le message de news:
    601598b4c7716@uwe...
    > Ardus Petus wrote:
    >>Try this:
    >>
    >>HTH
    >>--
    >>AP
    >>
    >>'---------------
    >>Sub InsertPB()
    >> Dim rTotal As Range
    >> Dim sFirstFound As String
    >> With ActiveSheet
    >> Set rTotal = .UsedRange.Find( _
    >> what:="Total", _
    >> lookat:=xlWhole)
    >> If Not rTotal Is Nothing Then
    >> sFirstFound = rTotal.Address
    >> Do
    >> .HPageBreaks.Add before:=rTotal.Offset(1, 0)
    >> Set rTotal = .UsedRange.FindNext(after:=rTotal)
    >> Loop Until rTotal.Address = sFirstFound
    >> End If
    >> End With
    >>End Sub
    >>'---------------
    >>> Hi all,
    >>>

    >>[quoted text clipped - 4 lines]
    >>>
    >>> Thks in advance

    >
    > Thanks AP,
    >
    > Works just fine. U'r a genius.
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200605/1




+ 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