Welcome to another Macro Monday. Today I am going to share with you how to create a macro that will print a number of Excel worksheets in our Excel workbook., but only the sheets we specify. This is an alternative to manually selecting and then printing them one at a time or holding down the CTRL key and select all of the work sheets you want to print.
I love this little macro, and find it especially useful when I have a regular report with a number of selected sheets I need to print every time. Let’s get started.
What Does The Macro Do?
Its prints only the Excel worksheets that you specify.
How Does It Work?
It is fairly simple, we need to specify in an array the sheets we want printed using the PrintOut method to trigger Excel to do the printing. All of the sheets that we specify will be printed in the one print job.
FIRST Create A Module. Open Visual Basic – by hitting F11 or Developer Tab – Visual Basic
Step 1 . Declare our variables. We need to declare the number of copies we want to print. In my case 3x people require the report. So I am setting it to default to 3.
Step 2. We specify the an array which contains to worksheets we want to print within our active workbook.
Step 3. We now speciy the number of copies we need, as stated in Step1, it’s 3 copies.
Step 4. TEST your Macro
That’s it. Simple. You can either save this in your Personal Macro Workbook So it is always available to you when you start Excel. Here is the code below.
If you want to download the example code in today’s Macro Monday you can do so here.
Dont forget to SUBSCRIBE to the How To Excel At Excel Newsletter for more tips the first Wednesday of the month.