VBA-Format every tab to print all columns width to one page and print in landscape

laurenh345

New Member
Joined
Mar 13, 2020
Messages
19
Office Version
  1. 2007
Platform
  1. Windows
Hi,

Can someone please help me. I have an excel sheet with 150+ tabs and I need the following conditions to be met and looped through every tab.
1. every tab to print in landscape form
2. fit all columns to the width of one page.
3. repeat rows $1:$2 at the top of every page(since a tab can consist of multiple pages when printed.)

I came up with the following VBA but I need it to loop through every tab in the workbook. Thanks in advance for any help on this!

Sub FITPAGESTO_ONEPAGE()
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
Sheets(sh).PageSetup.Orientation = xlLandscape
End With
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Maybe...
VBA Code:
Sub FITPAGESTO_ONEPAGE()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
        With ws.PageSetup
            .PrintTitleRows = "$1:$2"
            .Zoom = False
            .FitToPagesWide = 1
            .FitToPagesTall = False
            .Orientation = xlLandscape
        End With
    Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,461
Members
449,085
Latest member
ExcelError

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