[RESOLVED] How to setup printing of dynamic tables?
Hi guys,
I have a problem that seems not to be exotic, however I couldn't find any solution via googles. I'm developing a universal macro to print reports from excel. Report need to be fit to one page wide by X pages tall (I use landskape orientation). Reports may have different number of rows and different number of columns as well. The problem is: how to find out how many pages a particular report will have? As sum of column's widht is a variable, the number of rows on each page is a variable too.
I assumed that sum of columns width to sum of rows height would be a fixed ratio (from my calculation this would be about 1,330978261), however doing it this way didn't worked well. :sick:
Do you have any ideas how to deal with it?
Re: How to setup printing of dynamic tables?
if you set it to fittopagewide it will adjust the number of pages by the scaled font size, so do you need to know how many pages?
in my help file it specifies that this property only applies to the pagesetup property of worksheets (not ranges)
Re: How to setup printing of dynamic tables?
Thanks for looking into this, Westconn1!
Meanwhile I have eventually managed to find the solution!
http://www.ozgrid.com/VBA/printed-pages.htm
...and this baby works! :thumb:
Also, when setting up printing by macro this may occur helpful:
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = False - by this you let to print as many pages as need
End With
:)
Re: How to setup printing of dynamic tables?
it you do not set pages tall to any value, it would be false by default, which was what i was indicating above
pls mark thread resolved