+ Reply to Thread
Results 1 to 4 of 4

Insert Page Break

  1. #1
    Don
    Guest

    Insert Page Break

    Is it possible to insert a page break automatically when specific text is
    encountered in row A. This report is hundreds of pages long and I need an
    automatic page insert macro. Can someone give me the syntax of a macro if
    the specific text is "Break"? Thanks for any help.

    --
    Don Rountree

  2. #2
    tina
    Guest

    RE: Insert Page Break

    Hi Don
    Try
    Sub Macropagebreak()
    For Each CELL In Range("A:A")
    If CELL = "BREAK" Then
    CELL.Rows.Select
    ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
    Else
    End If
    Next
    End Sub

    "Don" wrote:

    > Is it possible to insert a page break automatically when specific text is
    > encountered in row A. This report is hundreds of pages long and I need an
    > automatic page insert macro. Can someone give me the syntax of a macro if
    > the specific text is "Break"? Thanks for any help.
    >
    > --
    > Don Rountree


  3. #3
    Don
    Guest

    RE: Insert Page Break

    Thank you for your help. I entered this macro and when I ran it I got the
    error message that said - Complie error, variable not defined. The first
    instance of the word CELL was highlighted. Please tell me how to define this
    variable.
    --
    Don Rountree


    "tina" wrote:

    > Hi Don
    > Try
    > Sub Macropagebreak()
    > For Each CELL In Range("A:A")
    > If CELL = "BREAK" Then
    > CELL.Rows.Select
    > ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
    > Else
    > End If
    > Next
    > End Sub
    >
    > "Don" wrote:
    >
    > > Is it possible to insert a page break automatically when specific text is
    > > encountered in row A. This report is hundreds of pages long and I need an
    > > automatic page insert macro. Can someone give me the syntax of a macro if
    > > the specific text is "Break"? Thanks for any help.
    > >
    > > --
    > > Don Rountree


  4. #4
    Dave Peterson
    Guest

    Re: Insert Page Break

    Sub MacroPageBreak()
    Dim Cell as Range '<-- add this line
    '''rest of code here

    Don wrote:
    >
    > Thank you for your help. I entered this macro and when I ran it I got the
    > error message that said - Complie error, variable not defined. The first
    > instance of the word CELL was highlighted. Please tell me how to define this
    > variable.
    > --
    > Don Rountree
    >
    > "tina" wrote:
    >
    > > Hi Don
    > > Try
    > > Sub Macropagebreak()
    > > For Each CELL In Range("A:A")
    > > If CELL = "BREAK" Then
    > > CELL.Rows.Select
    > > ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
    > > Else
    > > End If
    > > Next
    > > End Sub
    > >
    > > "Don" wrote:
    > >
    > > > Is it possible to insert a page break automatically when specific text is
    > > > encountered in row A. This report is hundreds of pages long and I need an
    > > > automatic page insert macro. Can someone give me the syntax of a macro if
    > > > the specific text is "Break"? Thanks for any help.
    > > >
    > > > --
    > > > Don Rountree


    --

    Dave Peterson

+ 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