Macro - printing multiple sheets in the same workbook

Aussie5380

New Member
Joined
Sep 30, 2022
Messages
32
Office Version
  1. 2019
Platform
  1. Windows
Hey there, fairly new to excel but need some guidance with macros for printing.

I want to create a macro to print out the sheet that the button is on, as well as another sheet from the same workbook.

Basically its a calculator i have built, which also has a checklist generator on another sheet. I want to be able to print the calc sheet and the checklist sheet into a single file (mostly used for PDF printing)

There are 3 calc sections. I want to be able to create a print button on each calc sheet to print that calc page and the checklist associated with it.

This is how my workbook looks:

Screenshot 2022-09-30 184029.png

I want to be able to have:

Sheet 2 and Sheet 1 print into a single file (with button being on Sheet 2)
Sheet 6 and Sheet 5 print into a single file (with button being on Sheet 6)
Sheet 9 and Sheet 10 print into a single file (with button being on Sheet 9)

I'm guessing i will need 3 macro buttons (one on each page with their respective sheet assignments for printing)

I've tried following a few video's but i keep running into error 9. Below is what i have come up with so far but still getting error 9:

Sub PrintSheets()

ThisWorkbook.Worksheets(Array("Sheet1", "Sheet2")).PrintOut

End Sub

Any assistance would be greatly appreciated! :)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi there,

Sheet1 and Sheet2 are the code names for the sheets, use the sheet names from the tabs instead like (correct them if needed)
VBA Code:
Sub PrintSheets()
ThisWorkbook.Worksheets(Array("Checklist - Full time AMBO", "Full time AMBO")).PrintOut
End Sub
And remember that you will always print to the unit which is selected as standard.

Ciao,
Holger
 
Upvote 0
Solution
Hi Aussie5380,

glad I could contribute to solve your problem.

Ciao,
Holger
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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