+ Reply to Thread
Results 1 to 13 of 13

Printing worksheets in a specific order

  1. #1
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Printing worksheets in a specific order

    Here's an odd one...I have a workbook that contains a master sheet which includes time-specific events. Those random events end up on individual worksheets within the workbook. I have a macro which will print only the sheets that end up with a time and event on them. After I print the workbook, I have to spend time sorting the sheets into the correct (time) order. Is there a way for Excel to loop through the workbook and print the sheets in sequential (time) order?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Printing worksheets in a specific order

    You need to post a sample workbook. Also, you did not explain how events are distributed out to the relevant worksheets.
    To attach a Workbook
    (please do not post pictures or links to worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    Each worksheet is populated from the master (Comm Test Sheet). The times entered for the specific events populate onto the worksheets in various cells but to simplify, I have made the time populate into cell BB1. That is the cell Excel can reference to determine the order to sort the sheets.

  4. #4
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    Trying to upload the file here. Hope this works for me...
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Printing worksheets in a specific order

    If the event time is in cell BB1 of each sheet, then try:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    (Sorry...just returned to work after the holiday weekend...) The code looks AMAZING. However, a couple of things are going askew during the print process. The sheets are being sorted correctly on the temp sheet (I can tell because it printed out; which is okay) but they are actually printing in an undeterminable random order. Also, they are printing 2-sided now instead of 1-sided (1-sided preferred). I appreciate anything you can do to fix this. I know this took a lot of effort and I really appreciate your work.
    Last edited by mailrail; 05-26-2015 at 09:58 AM.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Printing worksheets in a specific order

    Made a slight mod to print sequence highlighted in yellow below.
    It prints each sheet individually selecting.

    Please Login or Register  to view this content.
    Last edited by protonLeah; 05-26-2015 at 07:39 PM.

  8. #8
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    I will check it first thing in the morning. Thanks so much for your prompt and efficient attention. In my original macro, I had a warning message at the very beginning. Couldn't I just paste it in or would that cause a conflict?

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Printing worksheets in a specific order

    Those lines will not conflict with the code I gave you. Just paste them in as you wish.

  10. #10
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    Amazing. Superbly done. EXACTLY what I needed. Thanks for your kind assistance and your time.

  11. #11
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    Ugh...I cannot for the life of me get the Message Box to work. When I pasted in the old message from a previous macro, I'm getting a 'Compile error: Variable not found'. I'm wanting a message that tells the user that the desired printer must be set as default. If yes, workbook prints. If no, workbook does not print and another message tells the user to set the desired printer as default. Should I not be putting this in front of your code? I did paste a line at the very end which returns the workbook to the first sheet - it works fine.

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Printing worksheets in a specific order

    If you are referring to the variable "response", in your original code (several subs) it is never declared with a Dim statement.
    In my sub, I use an Option Explicit statement to force explicit declaration of all variables in that module.

    Try, at the top of the module, with the other Dim lines, adding the line:
    Dim response as Variant
    Last edited by protonLeah; 05-27-2015 at 05:08 PM.

  13. #13
    Registered User
    Join Date
    05-22-2015
    Location
    Louisville, KY
    MS-Off Ver
    Office 2010
    Posts
    14

    Re: Printing worksheets in a specific order

    Bingo. Worked like a charm. That will close out this workbook. Thanks for all your help Ben.

+ 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. VBA Code to PDF a List of Specific Worksheets in Order
    By mbhart in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2014, 06:11 PM
  2. Searching worksheets in a specific order
    By sew2009 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 01-01-2011, 11:57 AM
  3. Printing specific excel worksheets in VB.NET
    By ecd1973@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2006, 11:30 AM
  4. print specific worksheets in specific order.
    By jarvo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2006, 06:10 AM
  5. Ordering Worksheets:specific order
    By PGalla06 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2005, 05:15 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