+ Reply to Thread
Results 1 to 10 of 10

Print only cells with data in a specified range

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Print only cells with data in a specified range

    I have an excel invoice where in Sheet "INVOICE" Range B11:B31 (on my invoice) product codes are listed .

    When I make an invoice, all the cells in range "B11:B31" will not be filled with data.

    So when I'm printing the invoice I'd like those cells that are blank (within that selection), NOT to print (the entire row of the blank cell in the range) and so the invoice would shrink up... does this make sense?


    Also would want to print only page 1 of sheet "INVOICE"

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Print only cells with data in a specified range

    Run this macro before printing
    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Print only cells with data in a specified range

    I have this code to print my file:

    Please Login or Register  to view this content.
    Should i add both macro to a command button and run it?

  4. #4
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Print only cells with data in a specified range

    Hey so i added a command button and attached macro for hiding and printing.

    However I dont want it that way.

    When I run your macro then it hides the blank cells in my excel file and then keeps it that way itself.

    Is it possible that when printing it automatically does not print blank cells ?

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Print only cells with data in a specified range

    No, you need to hide the cells so that they are not printed. After printing, you need to run a macro to unhide the cells or unhide them manually.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Print only cells with data in a specified range

    Hey,

    I made a command button and added 3 macros to it.

    macro 1: to hide rows

    Please Login or Register  to view this content.
    Macro 2: to print
    Please Login or Register  to view this content.
    Macro 3: to unhide
    Please Login or Register  to view this content.


    The problem is that the process takes too long.

    It takes way too long to hide, then print, then unhide.

    Any suggestions?

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Print only cells with data in a specified range

    At the beginning of the first macro, type
    Please Login or Register  to view this content.
    and at the end of the last one
    Please Login or Register  to view this content.
    considering consolidating to one macro.

  8. #8
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Print only cells with data in a specified range

    Hey thanks,

    I will implement this code.

    But it hangs up the system for about 5-10 seconds.

    Any way to avoid it?

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Print only cells with data in a specified range

    Cannot make any determination with the information you have provided.

  10. #10
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,269

    Re: Print only cells with data in a specified range

    Using union or filter for Quiqly
    Please Login or Register  to view this content.
    Or using union
    Please Login or Register  to view this content.
    Last edited by daboho; 02-16-2018 at 12:47 AM.

+ 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. Print Cells from Name Range
    By BLS99covert in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2014, 07:34 PM
  2. Dynamic / Named Print Range To Include Another Range of Cells
    By thekrakenwakes in forum Excel General
    Replies: 0
    Last Post: 07-25-2014, 07:52 AM
  3. Set print area of selected range then print preview if ok then print the document!
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 07:10 AM
  4. Solved: Formatting Cells within Print Range
    By bcap in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-08-2012, 12:49 PM
  5. Print only range of cells that include data, even if all cells formatted
    By liam_bettinson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2012, 09:41 AM
  6. VBA to set print range, open box asking for print qty, print, then redefine print area
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:43 PM
  7. Print range of cells
    By leighmills33 in forum Excel General
    Replies: 6
    Last Post: 02-11-2010, 03:18 PM

Tags for this Thread

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