Results 1 to 14 of 14

Setting print area based on input

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2013
    Location
    Chaska, MN
    MS-Off Ver
    Excel 2010
    Posts
    24

    Setting print area based on input

    Hello,

    I am trying to automate filling out and printing various forms to save time. Right now I am having trouble with the attached form. This form dynamically updates based on how many mixes we are making of a certain product. The way we currently have to print this form is to select the cells we want to print and use print selection. This takes time and ruins an almost completely automated process that I have worked hard to make. I have tried using the following code to set the print area but it only works for the repeating top four rows.

    Worksheets("QA Pkng Audit (FM-12)").PageSetup.PrintArea = Worksheets("QA Pkng Audit (FM-12)").Range("A1:M" & Worksheets("QA Pkng Audit (FM-12)").Range("M" & Rows.Count).End(xlUp).Row).Address
    The result is shown in the attached picture called wrong. The correct way it should come out for 2 mixes is attached called right.

    But I know that with each new mix added is 3 more rows and the minimum number of mixes of 1 I should be able to just have a linear scaling expression that adds 3 more rows per mix.

    I want the minimum print area to be A1:M7 and the max to be A1:M181 but max doesn't matter I can make it as long as we need. If we were making two mixes the print area would be A1:M10 and three would be A1:M13.

    What expression do I need that will make this happen? I think it would involve something like PrintArea("A1:M" & 7 + NumberofMixes * 3) but I do not know enough about VBA to make it work.


    The attached form is an example to show how the form updates but is not set up to print correctly aside from there being 7 mixes on each page with the repeating 4 rows at the top. It is supposed to be in landscape and set up to fill out the page beautifully but I thought it was not that important compared to decieding what to print .

    Thank you for your help,
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by QAChaska; 12-03-2013 at 11:54 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Setting a print area in vba
    By harveywalker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 10:47 AM
  2. Setting Print Area based on Columns
    By ridonculous in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2012, 07:00 PM
  3. setting up the print area
    By Gina in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2006, 01:15 PM
  4. Print Area:What would be the code for setting the print area
    By wammer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2005, 02:05 AM
  5. Setting Print Area
    By Defoes Right Boot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2005, 08:06 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