Set an undefined (variable) print area through a Macro

  • Thread starter Thread starter Kate
  • Start date Start date
K

Kate

Does anyone know how to set up a macro that will
automatically set the print area to a changing number of
rows?
For example, if one list has 20 rows of data and the other
list has 100 rows available,I'm looking for it to set the
print area for both lists using the same macro.
 
Interesting idea. The following formula, tested with Print Preview,
sets the range on a worksheet by worksheet basis. Adjust to your
specific requirement.

Print_Area =OFFSET(!$A$1,0,0,COUNTA(!$A:$A),COUNTA(!$1:$1))

Note the use of addresses without the sheet name but with a leading !

The specific formula above is actually not very useful, but it
illustrates the key principle involved.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top