Print Multiple Pages from one sheet

The_Steward

Board Regular
Joined
Nov 26, 2020
Messages
63
Office Version
  1. 365
Platform
  1. Windows
Hey,

i'm looking to create a 7 page PDF using data from one sheet in my workbook. 2 pages (First two ranges) worked successfully but any more than that has not worked.

VBA Code:
Sub Printpdf()
    With ActiveSheet.PageSetup
        .PrintArea = "$A$1:$B$24,$C$1:$H$24,$I$1:$I$24,$A$28:$B$48,$C$28:$H$48,$I$28:$I$48,$B$52:$C$53"
        .FitToPagesWide = 1
        .FitToPagesTall = False
    End With
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Plan Review Budget", Quality:=xlQualityStandard, _
  IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=True
  End With
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Change the ranges in the array to suit your needs
Code:
Sub Maybe_So()
Dim prArr, i As Long
prArr = Array("A1:D10", "C4:F5", "B12:I17", "C6:J38", "F5:K22", "D1:K40", "D12:J35")
Application.ScreenUpdating = False
    For i = LBound(prArr) To UBound(prArr)
        With ActiveSheet.PageSetup
            .PrintArea = prArr(i)
            .FitToPagesWide = 1
            .FitToPagesTall = False
        End With
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Plan Review Budget Page " & i + 1 & ".PDF", Quality:=xlQualityStandard, _
        IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=False
    Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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