+ Reply to Thread
Results 1 to 2 of 2

Printing a selection of rows

  1. #1
    Registered User
    Join Date
    11-08-2005
    Posts
    2

    Exclamation Printing a selection of rows

    Thanks for the quick help last time.

    I have data in rows and columns by a Rep name. Some Reps have one row some reps have 4 rows. I would like to print a single page for each with the data that belongs to them. Such as if a Rep only has one row only one prints out if another Rep has three then all three print on the same sheet.

    Any thoughts?

    thanks,
    jason
    Last edited by Jbucks007; 11-17-2005 at 05:59 PM.

  2. #2
    Nigel
    Guest

    Re: Printing a selection of rows

    The following reads the column A and if the contents changes from the
    previous row a horizontal page break is inserted.......

    Note: You might want to sort the data before this run to ensure each set of
    data are together. Also Excel has a limit of 1026 HPageBreaks per sheet.

    Sub PagesBrk()
    Dim xlr As Long, xr As Long
    xlr = Cells(Rows.Count, 1).End(xlUp).Row
    For xr = 2 To xlr
    If Cells(xr, 1) <> Cells(xr - 1, 1) Then
    ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Rows(xr)
    End If
    Next xr
    End Sub

    --
    Cheers
    Nigel



    "Jbucks007" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks for the quick help last time.
    >
    > I have data in rows by a Rep name. Some Reps have one row some reps
    > have 4 rows. I would like to print a single page for each with the
    > data that belongs to them. Such as if a Rep only has one row only one
    > prints out if another Rep has three then all three print on the same
    > sheet.
    >
    > Any thoughts?
    >
    > thanks,
    > jason
    >
    >
    > --
    > Jbucks007
    > ------------------------------------------------------------------------
    > Jbucks007's Profile:

    http://www.excelforum.com/member.php...o&userid=28661
    > View this thread: http://www.excelforum.com/showthread...hreadid=486051
    >




+ 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