+ Reply to Thread
Results 1 to 2 of 2

Need ‘Set Print Area’ Code for Dynamic Print Range based on Conditions

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2010
    Posts
    34

    Need ‘Set Print Area’ Code for Dynamic Print Range based on Conditions

    Hey, guys. I need your help again, please.

    This VBA code works for our reports with constant-changing bottom margins:

    ActiveSheet.PageSetup.PrintArea = "=" & ActiveSheet.UsedRange.Address

    I need it changed as follows:

    1. The right margins should reset based on these conditions: If column N has no dollar amounts, then print A1 through column L. If column N does have dollar amounts, then print A1 through column N. Note that in cell N9 there is a heading label.

    2. The reports are landscape orientation. They need to fit on 1 page wide no matter which columns print. (The last 2 or 3 columns will print on the 2nd page if the print settings are not manually changed. I would like the code to do this for me).

    3. The very last row has only a grand total in column F, which needs to be included in the print range. This row changes for each report.

    I hope this is sufficient info - please let me know if you need more.

    Thanks,

    Debbie

  2. #2
    Registered User
    Join Date
    07-10-2013
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Need ‘Set Print Area’ Code for Dynamic Print Range based on Conditions

    I apologize if what I asked is too complex or confusing. I really have tried to figure it out myself from internet searches and I'm having no luck. So.....maybe someone can help if I change the conditions to this:

    Column M may contain text values "D" or "A" (but some cells may be blank). There is no heading label for column M.

    If column M contains an "A" anywhere, then I need the code to set the print area from A1 to column N, down to the last row with data. If column M doesn't contain "A", then I need the print area set from A1 to column M, down to the last row with data.

    Please let me know if I need to provide anything else.

    Thanks!!

+ 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. Replies: 2
    Last Post: 01-04-2013, 04:22 PM
  2. [SOLVED] print area with dynamic range when the database are with subtotals
    By sari.sari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 07:37 AM
  3. 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
  4. Dynamic Print Area converting to Static range
    By bnl552 in forum Excel General
    Replies: 1
    Last Post: 06-15-2012, 01:14 PM
  5. [SOLVED] dynamic print area based on cell value
    By [email protected] in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-13-2006, 11:25 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