+ Reply to Thread
Results 1 to 9 of 9

Print Range Macro

  1. #1
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Print Range Macro

    I am using this code to define the printing range of my Picture sheet. Depending on if a certain cell is empty or not, the page will be printed or not.

    Please Login or Register  to view this content.
    The problem is that all cells which I check contain formulas, which are considered as empty by excel, thus the page is not printed, despite it having content.

    I already tried to replace the
    Please Login or Register  to view this content.
    but without success. Any ideas on how I can fix that nasty little problem?

    Thanks,
    A2k
    Last edited by Armitage2k; 08-14-2009 at 01:23 PM.

  2. #2
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: Printing Range Macro Problem

    really no one has any clue...? Come excel-gods, dont let me loose faith in you!!

    A2k

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    re: Print Range Macro

    Hello Armitage2K,

    See if this version works. If not, post your workbook for review.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    re: Print Range Macro

    Wonderful, progress has been made.

    Well, now the printing range successfully changes. However, now instead of the entries which have a value, it decides to out all entries into my printing range, especially those which are supposed to be empty.

    Enclosed my workbook.

    A quick explanation of what I am doing. I am displaying data from another sheet on my Picture Sheet by using the formula
    Please Login or Register  to view this content.
    the problem is that I have pulled this formula down over 50 rows, but not all 50 rows on the other sheet have content. When I print the current sheet though, excel does not get that and still considers them with content because the formula is in these cells.

    here my most updated code
    Please Login or Register  to view this content.
    thanks,
    a2k

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    re: Print Range Macro

    Hello A2K,

    You want to printout only the cells in each of the ranges that don't contain an empty string, yes? This can be done as long as the cells are contiguous (touching each other, unbroken).

    For example, if "C47" is true then the full range is "A2:D50". If only cells "A2:D25" have data, no problem. However, if the cells were like "A2:D10, A15:D25", the five rows "A11:D14" would still be included in the printout.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    re: Print Range Macro

    Hmmm.. this still does not work...

    OK, I have pulled my formula down and have it in every row C1:C50.
    Now, not every cell on the other sheet has data in it, thus is the cell is shown empty (If(VIP!C3=0,"",VIP!C3). Right now, only the cells from C3:C21 have content, but the printing range is still for the whole C3:C50.

    Any ideas if that can be fixed?
    Thanks for all your efforts Leith, and sorry for being a pest,
    A2k

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    re: Print Range Macro

    Attaching a workbook and explaining in context would eliminate the flailing ...
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    re: Print Range Macro

    Hello A2K,

    Based on the tests I have done, the code works correctly. We are spending a lot of time chasing ghosts. I agree with SHG. You should post your workbook for review.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Print Range Macro

    Armitage why have you marked this thread tile s UNSOLVED? Read the Forum rules about thread titles 7 bumping your posts
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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