+ Reply to Thread
Results 1 to 16 of 16

Remove blank rows and print only selected worksheets

  1. #1
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Remove blank rows and print only selected worksheets

    Hi all, working in Excel 2010 I have an document that I want to print only certain sheets and also not print blank rows (I have rows with formulas but no data). Thank you.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Remove blank rows and print only selected worksheets

    Hi MARD99,
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Re: Remove blank rows and print only selected worksheets

    Attached is a workbook similar to the one that I am trying to print. The first two worksheets (Raw Data & Report Data) I do not want to print. The other ten worksheets I do want to print but omit blank rows.

    Thanks for responding to my post!!!!
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Remove blank rows and print only selected worksheets

    You can loop through the sheets and set the print areas, then print the sheet.

    Your working code would have "PrintOut" instead of "PrintPreview"
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Re: Remove blank rows and print only selected worksheets

    Thanks for your post. Can you incorporate code to omit the blank rows from printing? I'm trying not to have to set the print area for each sheet.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    If you already have the print area set then you can also write a macro to temprarily hide the empty rows before printing and then unhides them again.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  7. #7
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Re: Remove blank rows and print only selected worksheets

    That's part of the problem. I don't know how to write a macro to hide empty rows.

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    The I guess it's time to start learning

    Can you attach a file with some dummy data but that does have the page layout like you want it?
    I'll write you one macro so you can modify it to your liking (at the same time it will be good training) VBA is really very simple, just a set of instructions that are carried out one after the other.
    All it really does is translate your actions to lines of code.

    If I have this I want it to do that else do something else, etc.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Remove blank rows and print only selected worksheets

    Quote Originally Posted by MARD99 View Post
    Thanks for your post. Can you incorporate code to omit the blank rows from printing? I'm trying not to have to set the print area for each sheet.
    You have 100 rows of formulas, the code finds the last cell that has a value in it and sets the print area.

    @Keebellah- check out the previous posts for the workbook

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    I missed that one.
    I'll incorporate the code

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    Does this mean that you have set your print area to 99 rows?

  12. #12
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Re: Remove blank rows and print only selected worksheets

    I did not set a print area because it will be variable. The formulas in my actual file extend to row 1000.

  13. #13
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    Thse are the worksheet's printareas:

    Please Login or Register  to view this content.
    I assume that you do not want to include the ones colored red

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    You should have told met that the blank rows all contain formula's

    But this works:

    Place the code below in ThisWorkBook Project window

    Please Login or Register  to view this content.
    and this code in a module to invoke after you have printed the page

    Please Login or Register  to view this content.
    This will unhide the rows again.

    You could always write a macro to prompt with worksheet you want to print and at the end add the command unHideRows

    Let me know if it works
    Last edited by Keebellah; 07-28-2017 at 03:41 PM. Reason: syntax error

  15. #15
    Registered User
    Join Date
    07-26-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    7

    Re: Remove blank rows and print only selected worksheets

    I couldn't get the code to work....it's me I'm sure! I'm worn out for the day. I'll try again tomorrow. Thanks for your help!

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Remove blank rows and print only selected worksheets

    Can you explain what you did?
    Here's the file you posted with the code
    You have to run the unhide macro manually AFTER printing
    Attached Files Attached Files

+ 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. Printing Selected Pages from Multiple Worksheets into One Print Job
    By KivanAtaris in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 03:20 PM
  2. Print multiple selected worksheets to separate PDF's
    By Samantha McNeill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2010, 07:38 PM
  3. How to remove blank rows, then insert blank row conditionally, PLUS error proof
    By GTS115 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-05-2009, 11:39 AM
  4. Replies: 1
    Last Post: 09-30-2009, 12:14 PM
  5. How do I print out selected worksheets one after the other
    By Greeneyes 22 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-26-2005, 06:05 AM

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