ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to create a macro to print a page? (https://www.excelbanter.com/excel-discussion-misc-queries/230853-how-create-macro-print-page.html)

Matt

How to create a macro to print a page?
 
How to create a macro to print a page? How do I creat a macro print different
pages? so I will not have to print the entire book?

JBeaucaire[_90_]

How to create a macro to print a page?
 
This macro will print the active sheet at the moment you run it:
=========
Sub PrintThisSheet()
ActiveSheet.PrintOut copies:=1
End Sub
=========
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Matt" wrote:

How to create a macro to print a page? How do I creat a macro print different
pages? so I will not have to print the entire book?


Paul C

How to create a macro to print a page?
 
This will ask for a page range and print the specified range.

You could make a custom form to get both inputs at the same time and you
could also put in code to skip the print step if cancel is selected. This
will crash if both inputs are not given, but this is a quick and easy fix.

Sub Macro2()
x = Application.InputBox(prompt:="Start Page", Type:=1)
y = Application.InputBox(prompt:="End Page", Type:=1)

ActiveWindow.SelectedSheets.PrintOut From:=x, To:=y, Copies:=1
End Sub
--
If this helps, please remember to click yes.


"Matt" wrote:

How to create a macro to print a page? How do I creat a macro print different
pages? so I will not have to print the entire book?



All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com