Microsoft KB Archive/91134

{|
 * width="100%"|

Setting Print_Area to Adjust Automatically to Extracted Data

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 3.0, 4.0
 * Microsoft Excel for the Macintosh, versions 3.0, 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 &quot;Microsoft Excel User's Guide 1,&quot; 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.
 * 1) In the Define Name dialog, type the following line in the Refers to box:

=OFFSET(Extract,0,0,DCOUNTA(Database,,Criteria)+1,COLUMNS(Extract))
 * 1) 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.