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
trusxlsolBusiness Systems AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Didn't go through all of your code, but try using the following line of code to see if all the columns are selected.

OffSetClmn = ws.Cells(10, Columns.Count).End(xlToLeft).Column
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saurabh Singh TeotiaCommented:
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

0
trusxlsolBusiness Systems AnalystAuthor Commented:
I tried both solutions and both works, I prefer to use sktneer's method in VBA, but thank you both for help.
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Glad I could help. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.