Setting Print_Area to Adjust Automatically to Extracted Data

ID: Q91134


The information in this article applies to:


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

Additional query words: 3.0 range


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: July 29, 1999