Print macro from a list

KAJ31

New Member
Joined
Jun 10, 2020
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
Hello. I have a file with over 150 tabs. Sheets will be printed to PDF, based on the macro below. I used an array and named each sheet. This works. I would like an easier way, as there is so much room for error when creating and mistyping a sheet name in the macros or excluding. Every tab will be printed to 1 of the 7 pdf Is there way instead of the array to do a loop or a better way? Many thanks!


VBA Code:
Sub Print_PDF_Region1()
'These are all the tabs..
Sheets(Array("SOO LTS R1", "Hourly LTS R1", "FORECAST LTS R1", "SOO LTS R1 2100", "HOURLY LTS R1 2100", "HIST LTS R1 2100", "FORECAST LTS R1 2100", "SOO LTS R1 2500", "HOURLY LTS R1 2500", "HIST LTS R1 2500", "FORECAST LTS R1 2500", "SOO LTS R1 4200", "HOURLY LTS R1 4200", "HIST LTS R1 4200", "FORECAST LTS R1 4200", "SOO LTS R1 R100", "FORECAST LTS R1 R100", "HIST LTS R1")).Select
            
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "Q:\P7 Region 1.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Sub Print_PDF_Region1()


Sheets.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"Q:\P7 Region 1.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

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