Link to home
Start Free TrialLog in
Avatar of Ray Erden
Ray ErdenFlag for United States of America

asked on

Print Range

I need to print a dynamically changing range.  On the file attached I tried this using Sub named "DynamicPrintArea" assigned to Print button on "Cash Flow" worksheet but it cuts off on Year15 or just does not do it.  Tried OFFSET function in named range but failed as well (=OFFSET(‘Cash Flow’!$B$10,,,COUNTA(‘Cash Flow’!$B$1:$B$55),COUNTA(‘Cash Flow’!$B$1:$AZ$10))).  The number of rows are static but number of years subject to change up to column AZ.  I need to get this worked either using OFFSET function in the named range or via VBA procedure.  The code behind the print button works well with another range with dynamic rows and tried to modifiy for this range without much luck.  Once I clear the print area then click on Print then do print view it shows up to year 15.  Help will be much appreciated, thanks.  I put a formula in A54 currently displaying 24 for column count that VBA uses.
C--Users-rerden-Desktop-PrintRange.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your offset formula will be this..

=OFFSET('Cash Flow'!$B$10,0,0,COUNTA('Cash Flow'!$B$10:$B$53)+1,COUNTA('Cash Flow'!$B$10:$AZ$10)+4)

Open in new window

Avatar of Ray Erden

ASKER

I tried both solutions and both works, I prefer to use sktneer's method in VBA, but thank you both for help.
Glad I could help. :)