Print Specific Pages in Excel

Add to Favorites
Author:

This free Excel macro allows you to print a pre-specified selection of pages from Excel. This means you can print 2 pages from a 10 page workbook or file or 4 pages from that workbook etc.

The macro allows you to choose which pages you want to print by inputting the number for the from and to argument. The from argument is the page number from which printing will start and the to number is the page number up to which will be printed.

You can also make this macro more dynamic in nature by setting the from and to arguments equal to variables and then get numbers for those variables from a user input box or dynamic worksheet calculation.

Where to install the macro:  Module

Macro to Print Specific Pages in Excel

Sub Print_Specific_Pages()

'Prints page x to page x
'You tell Excel which pages you want to print - i.e. pages 1 to 5; pages 4 to 7; etc.
'Replace the 5 with the page number from which you would like to start printing
'Replace the 10 with the page number to which you would like to print in Excel

Worksheets.PrintOut from:=5, to:=10

End Sub





Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Print Different Headers for Odd and Even Pages in Excel
Tutorial: How to print pages in Excel with different headers for odd and even pages. Steps Go to the...
Print Preview Display for Specific Worksheets in Excel
Macro: This free Excel macro allows you to display the print preview mode or window in Excel for ...
Print Entire Workbook in Excel
Macro: This free excel macro allows you to print the entire workbook in Excel. You can easil...
Allow Only Certain People to Edit Specific Cells in Excel
Tutorial: How to allow only certain people to edit certain cells or ranges in Excel. This is a sec...
Count the Number of Cells that Start or End with Specific Text in Excel
Tutorial: How to count cells that match text at the start or the end of a string in Excel. If you w...
Determine if Cells Contain a Specific Value in Excel
Tutorial: Find if a cell or range of cells contains a specific value in Excel. This method can be us...


How to Install the Macro
  1. Select and copy the text from within the grey box above.

  2. Open the Microsoft Excel file in which you would like the Macro to function.

  3. Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.  Or For other ways to get there, Click Here.

  4. On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.

  5. If the Macro goes in a Module, Click Here, otherwise continue to Step 8.

  6. If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.

  7. If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.

  8. Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.

  9. You are now ready to run the macro.

Tutorial Details
Similar Content
Print Different Headers for Odd and Even Pages in Excel
Tutorial: How to print pages in Excel with different headers for odd and even pages. Steps Go to the...
Print Preview Display for Specific Worksheets in Excel
Macro: This free Excel macro allows you to display the print preview mode or window in Excel for ...
Print Entire Workbook in Excel
Macro: This free excel macro allows you to print the entire workbook in Excel. You can easil...
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course