Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Beddau, Mid Glamorgan, Wales
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multi Area Header (2000)

    Hi Guys:

    In VBA, is there a way of printing say rows 1 - 4 of the sheet and then rows 8 - 12 on each page? On the first page of the printout they're already there, of course, but on subsequent sheets rows 5 - 7 should not appear, so I can't use 'Columns to repeat at top'.

    To complicate matters, the range (number of rows) to be printed will vary, and is determined in code. Also, some rows may be multi-height (word-wrapped) so there is not a set number of rows on each page.

    At present, the code locates the auto page breaks at print time and prints the appropriate ranges at the top of each page, but this runs very slowly.

    Any ideas for a different approach welcome.
    Regards,

    Tony
    [s] [/s]
    www.SylviArtist.com

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Multi Area Header (2000)

    Couldn't you simplify the design of the workbook?
    Or perhaps create worksheets with copies of the areas that you want to print...

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Beddau, Mid Glamorgan, Wales
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multi Area Header (2000)

    Hi Hans:

    Unfortunately, the w/b design has to match design considerations elsewhere (CAD, I think - it's not my w/.

    I'll play with the copy to new w/s idea.

    Thanks,
    Regards,

    Tony
    [s] [/s]
    www.SylviArtist.com

  4. #4
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Multi Area Header (2000)

    If I understand your example correctly you want the following printout:

    <UL><LI>Page 1:- Rows 1 through 12
    <LI>All subsequent pages-: Rows 1 through 4, and 8 through 12 [/list]Please confirm or restate the requirement.
    Regards
    Don

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Multi Area Header (2000)

    Try the following: <pre>Sub SelectivelyPrint()

    Const FirstHidden = 5
    Const LastHidden = 7
    Const LastPrintCol = "AA"
    Const LastPrintRow = 12
    Const MaxPagesPrint = 1000

    ActiveSheet.PageSetup.PrintArea = _
    "$A$1:$" & LastPrintCol & "$" & LastPrintRow
    ActiveWindow.SelectedSheets.PrintOut _
    From:=1, To:=1, Copies:=1, Collate _
    :=True
    Rows(FirstHidden & ":" & LastHidden) _
    .EntireRow.Hidden = True
    ActiveWindow.SelectedSheets.PrintOut _
    From:=2, To:=MaxPagesPrint, Copies:=1, _
    Collate:=True
    Rows(FirstHidden & ":" & LastHidden) _
    .EntireRow.Hidden = False
    End Sub
    </pre>


    H.T.H.
    Regards
    Don

Posting Permissions

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