+ Reply to Thread
Results 1 to 7 of 7

macro print non-empty cells

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    macro print non-empty cells

    Hello in the attached workbook there is a macro that selects only the non-empty cells and then prints the various sheets.
    Now only a certain number of cells are active and 3 sheets are printed with the print titles in the 3 sheets.
    I request a chang:
    you have to print in addition to the active sheets (non-empty cells), a last sheet with the yellow cells of the range A207: L2017 without printing titles like the previous sheets.
    I hope I explained myself.
    A greeting.
    max
    Attached Files Attached Files
    Last edited by max_max; 11-07-2018 at 05:09 PM.

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

    Re: macro print non-empty cells

    Hi, Ciao,
    A question. the Yellow area, will that always be the same size? Rows 207 -217?
    The table above will then always end at row 206?
    Is this correct?
    My first suggestion is to change the range A5-L206 to a table, that way you can apply the filter without having influence on the yellow section below.
    Define two Print areas, one form A1-L206 for the three pages with the headers and on of the yellow section A207-L217, then all you have to do is set the filter in the first column to non blanks and print the first part and the set the print area to the yellow part and print that area.
    I'll try to implement it with the sample file you attached, but this is the idea.
    ---
    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

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

    Re: macro print non-empty cells

    Here is my way of doing it, if you press STAMPA now you'll have to print it to see the result. Preview will not work correctly
    Attached Files Attached Files

  4. #4
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro print non-empty cells

    Hi keebeelah,
    I tried but there is a 438 error with the line:

    Application.PrintCommunication = False

    I have excel 2007 and this does not work.
    I found a solution on the net:

    On Error Resume Next
    Application.PrintCommunication = False
    Err.Clear

    Please Login or Register  to view this content.
    everything works now.
    The macro is perfect.
    Greetings and thank you very much.
    max

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

    Re: macro print non-empty cells

    That does happen sometimes and maybe it is a 2007 issue
    But, does your addition work?

  6. #6
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro print non-empty cells

    Yes, it works

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

    Re: macro print non-empty cells

    And THAT is what it should do
    Glad to hear.
    The error you mention is sometimes also related to the current active printer (driver) which does not communicate with Windows and then you can also get the same error

+ 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 ISSUE: Empty Print Preview
    By wedzmer in forum Excel General
    Replies: 1
    Last Post: 06-21-2018, 10:42 AM
  2. MACRO to empty a range of cells based on whether specified cell is empty
    By TBJV in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2013, 10:35 PM
  3. Do not print if cells are empty
    By kmlloyd in forum Excel General
    Replies: 9
    Last Post: 04-22-2013, 11:50 AM
  4. [SOLVED] print only data and no empty cells
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2012, 11:22 AM
  5. Resolved >>> Checking Cells are empty before print macro
    By geff in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-25-2007, 06:33 AM
  6. Replies: 1
    Last Post: 05-15-2006, 04:10 AM
  7. macro to colour empty cells (cells not recognized as empty)
    By Gerben in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2005, 11: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