Page set all worksheets

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Page set all worksheets

Post by ABabeNChrist »

I have 4 different workbooks with various number of worksheets that I have combined together. The problem I have is when it comes to printing. Since the worksheets come from different workbooks and where created at different times the fonts and page margins print different, even though the fonts are the same size. I tried using.

Code: Select all

        Application.ScreenUpdating = False
        
        ActiveSheet.ResetAllPageBreaks
        
        With ActiveSheet.PageSetup
            .CenterFooter = "&14&P"
            .LeftMargin = Application.InchesToPoints(0.1)
            .RightMargin = Application.InchesToPoints(0.1)
            .TopMargin = Application.InchesToPoints(0.25)
            .BottomMargin = Application.InchesToPoints(0.5)
            .HeaderMargin = Application.InchesToPoints(0.3)
            .FooterMargin = Application.InchesToPoints(0.3)
            .CenterHorizontally = True
            .CenterVertically = False
            .Zoom = 66
            Application.ScreenUpdating = True
        End With
The code works as it was intended I checked each sheet, but the pages still do not match.
Some appear as if the margin are still set to narrow. Could this be caused by the zoom.
:scratch:

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Page set all worksheets

Post by HansV »

Excel always keeps a column together on one page, i.e. the width of a column is never split over two pages. If the rightmost column would overlap the right margin, that column is shifted to a next page in its entirety.

Since column widths vary, this means that the printed pages need not have the same width. Some pages will just fit within the margins, others may leave a considerable amount of white space.

If you want all pages to have the same effective left margin, set .CenterHorizontally to False instead of to True (as a consequence, the effective right margin will vary more, of course).
Best wishes,
Hans

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Page set all worksheets

Post by ABabeNChrist »

You hit the nail right on the head. I was thinking on the same line. That since my columns width are most likely different from sheet to sheet thus causing the printing areas to also be different. I’ll try changing the CenterHorizontally from True to False and see how it looks.

Thank you Hans

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Page set all worksheets

Post by ABabeNChrist »

Hi Hans
I tried using the center alignment on false and it still gave the appearance that the sheet looked different. So what I did was expand a few column widths on the sheets that appeared narrower than the rest by first printing all sheets in a PDF format, then by doing a comparison I made some subtle changes so as not to change the actual sheet layout, at least not enough to tell. It took a little doing. I’m not totally completed yet but I think I am on the right track. The reason I took the narrower sheets and made them wider, instead of the other way around (which could be done) it allowed more area for my text, dropdown comments and photos. So actually it was a win win situation, just a little bit of my time and a big cup of java. :coffeetime: