+ Reply to Thread
Results 1 to 9 of 9

Printing multiple selections

  1. #1
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Printing multiple selections

    Hi,

    I would like to print several selections on a worksheets, and also some other selections on another worksheet.
    Here is the code I'm using:

    Range("A1:D4").Select
    Selection.PrintOut Copies:=1, Collate:=True

    This works, when there is only one selection (print area). However I get printing errors (Could not print !filename!.xlsm) if I try to add further selections.
    I have tried to add a delay between printing selections and also DoEvents. The delay does help slightly, but I always end up getting an error before the printing is complete.

    Is there a better approach to printing several different selections in a workbook?

    Any help would be much appreciated.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,230

    Re: Printing multiple selections

    Printing always applies to continuous ranges.
    If you want to print non-continuous ranges on a single page, then you must collect (copy) them into a temporary sheet and print that sheet.

    Artik

  3. #3
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Printing multiple selections

    Thank you Artik, I wasn't aware of that.
    Although I should note, I am trying to print several areas of several worksheets, with each selection printing to a new sheet. Not print several sections as a single sheet.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,230

    Re: Printing multiple selections

    Then repeatedly define the range to print and print each range separately.

    Artik

  5. #5
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Printing multiple selections

    This is what I am doing, with no success.
    I understood your first reply to mean printing multiple ranges as one whole range, hence the collection of data into a new sheet. Does that still apply even though each range is to be printed as new sheets?

    The following doesn't work:

    Range("A1:D4").Select
    Selection.PrintOut Copies:=1, Collate:=True

    Range("E1:H4").Select
    Selection.PrintOut Copies:=1, Collate:=True

    Range("I1:L4").Select
    Selection.PrintOut Copies:=1, Collate:=True

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,230

    Re: Printing multiple selections

    Please Login or Register  to view this content.
    The first 3 lines of code will print the three ranges of the active sheet on separate sheets. The fourth line will print a range from the inactive sheet named "Sheet25".

    Artik

  7. #7
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Printing multiple selections

    Excellent! Very much appreciated!

  8. #8
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Printing multiple selections

    Unfortunately this doesn't help me. This is pretty much what I am currently doing.

    The first range prints fine. If I place each selection in a new sub, and run each in succession, they all print fine.
    I can even set the printer as a PDF output and it works as expected.

    But, all in one sub... multiple ranges, it doesn't work. Like I said, the first prints fine, but then I am presented with a printing error.

  9. #9
    Registered User
    Join Date
    11-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    12

    Re: Printing multiple selections

    Ah...
    Range("A1:D4, E1:H4, I1:L4").PrintOut copies:=1, collate:=True

    This works

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 08-12-2017, 09:57 AM
  2. List Box Selections Outputting Multiple Selections with One Click
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-21-2011, 12:27 PM
  3. Multiple selections from a pick list - only unique selections (no repeats) ?
    By opsayo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2011, 06:25 PM
  4. Printing Multiple Selections from Separate Worksheets
    By rboote in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2008, 02:03 PM
  5. Printing selections
    By Aurbo99 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2007, 04:43 PM
  6. Printing Multiple Selections on one page
    By Ben in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2006, 09:45 AM
  7. Printing non-adjacent selections
    By BJ Gates in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-04-2006, 04:40 PM

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