scaling up print range to fit page width...

RobbieC

Active Member
Joined
Dec 14, 2016
Messages
376
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I have a workbook and each sheet has a different range set as the print area. Some are bigger than others but on the whole they are all pretty similar.

I'd like to be able to set each page's print setup so that each 'print area' range fits to the width of the print paper (or PDF width)

This works for me:

Code:
With ActiveSheet.PageSetup
    .PaperSize = xlPaperA4
    .Orientation = xlPortrait
    .LeftMargin = Application.CentimetersToPoints(0)
    .RightMargin = Application.CentimetersToPoints(0)
    .TopMargin = Application.CentimetersToPoints(0)
    .BottomMargin = Application.CentimetersToPoints(0)
    .HeaderMargin = Application.CentimetersToPoints(0)
    .FooterMargin = Application.CentimetersToPoints(0)
    .CenterHorizontally = True
    .CenterVertically = False
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = False
End With

but only if the print area is BIGGER than the width of A4. It doesn't seem to 'scale up' if the range is smaller...

Can you help me out to scale the print area up to the width of the A4 print area?

Thanks very much
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi

Code:
Sub zooom()
Dim ws As Worksheet, i%, pc%
Const inc As Integer = 5                            ' zoom increase
Const safe As Integer = 20                          ' max iterations
Set ws = ActiveSheet
i = 1
pc = ws.PageSetup.Pages.Count
Do
    ws.PageSetup.Zoom = ws.PageSetup.Zoom + inc
    i = i + 1
    ActiveWindow.View = xlNormalView
    ActiveWindow.View = xlPageBreakPreview          ' update page count
Loop While i < safe And ws.PageSetup.Pages.Count = pc
If ws.PageSetup.Pages.Count > pc Then _
ws.PageSetup.Zoom = ws.PageSetup.Zoom - inc         ' spilled onto next page
MsgBox ws.PageSetup.Zoom, , "Final zoom"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,581
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top