I've done a lot of research on this site and haven't found a solution to my problem. I have a workbook with multiple sheets that have specific ranges that need to be printed. Unfortunately these ranges need to printed in a very specific order for a monthly report and it's easier to keep them on separate tabs. I created a code that allows me to print them to my office printer, but I'd like to be able to combine the sheets and then print them directly to PDF. Can anyone help me out? I can continue to use the print macro if not.
Thanks!
Questions/Thoughts
1) Am I able to select the ranges, and print all of them to a single pdf in one go?
2) if not perhaps its easier to print to two different pdfs (based on tab/worksheet) and then combine in adobe
Here's my code:
Sub PrintOut()
Answer = MsgBox("Ahoy scallywag! Would ye like t' print scroll?",
vbYesNoCancel + vbInformation, "Application Message")
If Answer = vbYes Then Else Exit Sub
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftMargin = Application.CentimetersToPoints(0.5)
.RightMargin = Application.CentimetersToPoints(0.5)
.TopMargin = Application.CentimetersToPoints(0.5)
.BottomMargin = Application.CentimetersToPoints(0.5)
.HeaderMargin = Application.CentimetersToPoints(0.2)
.FooterMargin = Application.CentimetersToPoints(0.2)
Worksheets("PTD and YTD Spend").PageSetup.CenterHorizontally = True
Worksheets("Leasing Detail").PageSetup.CenterHorizontally = True
Worksheets("PTD and YTD Spend").PageSetup.CenterVertically = True
Worksheets("Leasing Detail").PageSetup.CenterVertically = True
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$3:$AG$32"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$3:$AD$32"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$33:$AG$63"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$33:$AD$63"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$64:$AG$93"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$64:$AD$93"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$94:$AG$123"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$94:$AD$123"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$124:$AG$153"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$124:$AD$153"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$154:$AG$183"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$154:$AD$183"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$184:$AG$216"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$184:$AD$213"
ActiveWindow.SelectedSheets.PrintOut
Sheets(Array("PTD and YTD Spend", "Leasing Detail")).Select
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select 'Needed so that multiple sheets don't remain selected
End With
Application.ScreenUpdating = True
End Sub