Excel VBA Setting Page Breaks, then setting Page Print Area based on those Page Breaks

cfrehner

New Member
Joined
May 13, 2015
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have the following code running to set up the Print Area for a worksheet. Then it enters Page Breaks into the worksheet.

Code:
    With Sheets("SummaryView")
        .PageSetup.PrintArea = "$C$6:" & where.Offset(35, 0).Address
        .PageSetup.FitToPagesWide = False
        .PageSetup.FitToPagesTall = 1

    End With


     For i = xCol + 1 To where.Column Step xCol
        Sheets("SummaryView").VPageBreaks.Add Before:=Sheets("SummaryView").Cells(1, i)
    Next

My problem is this:
When it sets the page break, the page width is too wide to fit onto one page. I've tried PageSetup.Zoom = 75 to scale down the data, but this then removes the PageSetup.FitToPagesTall = 1 setting - therefore making the page too tall to fit on one page. (I understand that the .Zoom and the .FitTo settings are mutually exclusive.) I can't set the FitToPagesWide as a set number, as my data's width will vary.

What I would ideally like is to set the Vertical Page Break, keeping the FitToPagesTall = 1, and then to set the Print Area for the page I just created to fit completely on one page. Then repeat this process until the end of my data.

I hope this problem is clear, and I greatly appreciate your assistance.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hoping someone will see this. In a nutshell, want to create a Print Area, set Page Breaks, then with those pages I make, set each page to print 1 page tall x 1 page wide. Any help you could offer would certainly help.

Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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