Setting Print_Area to Adjust Automatically to Extracted Data

Last reviewed: November 30, 1994
Article ID: Q91134
The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0 and 4.0
  • Microsoft Excel for the Macintosh, versions 3.0 and 4.0
  • Microsoft Excel for OS/2, version 3.0

SUMMARY

In Microsoft Excel, it's possible to set a print area that adjusts automatically to the size of data extracted from your Microsoft Excel database.

MORE INFORMATION

When extracting data from a Microsoft Excel database, the number of records extracted may vary depending on the criteria and data in your database. To print the extracted records, you need to set a print area that includes all the extracted records. If you are printing from different extracts, you have to redefine the print area each time you print.

You can avoid having to redefine your print area each time by setting a print area that automatically adjusts to the data that you extract.

To Set an Automatically Adjusting Print Area

Important: This formula requires that you have set a database range, extract range, and criteria range. For information on setting these, see "Microsoft Excel User's Guide 1," version 4.0, pages 327-343.

  1. From the Formula menu, choose Define Name.

  2. In the Define Name dialog box, type Print_Area in the Name box.

    Note: If you have previously defined a print area, just select Print_Area from the Names in Sheet list.

  3. In the Define Name dialog, type the following line in the Refers to box:

    =OFFSET(Extract,0,0,DCOUNTA(Database,,Criteria)+1,COLUMNS(Extract))

  4. In the Define Name dialog box, choose the OK button.

Your print area now adjusts to the number of rows of data each time you perform an extract.

REFERENCES

"Microsoft Excel User's Guide 1," version 4.0, pages 327-343

"Microsoft Excel Function Reference," version 4.0, pages 299-300


KBCategory: kbprint
KBSubcategory:

Additional reference words: 3.0 3.00 4.0 4.00 range


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 30, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.