ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to print a selected range, not entire worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/51259-macro-print-selected-range-not-entire-worksheet.html)

James C

Macro to print a selected range, not entire worksheet
 

Hello all,

I have recorded a macro of the user selecting a range, then going File,
Print, Selection, Ok.

For some reason, the recorder collects the following line:
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

Running the macro results in my entire worksheet being printed

Unless I am missing something, how can I tweak this line so that only
my selection is sent to the printer?

Thanx.

- Jim


--
James C
------------------------------------------------------------------------
James C's Profile: http://www.excelforum.com/member.php...o&userid=12114
View this thread: http://www.excelforum.com/showthread...hreadid=477618


comotoman

Macro to print a selected range, not entire worksheet
 

You need to define your print range, if it is the same, re-record your
macro and while recording select and set your print area.


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=477618


Dave Peterson

Macro to print a selected range, not entire worksheet
 
What do you have selected when you run the macro?



James C wrote:

Hello all,

I have recorded a macro of the user selecting a range, then going File,
Print, Selection, Ok.

For some reason, the recorder collects the following line:
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True

Running the macro results in my entire worksheet being printed

Unless I am missing something, how can I tweak this line so that only
my selection is sent to the printer?

Thanx.

- Jim

--
James C
------------------------------------------------------------------------
James C's Profile: http://www.excelforum.com/member.php...o&userid=12114
View this thread: http://www.excelforum.com/showthread...hreadid=477618


--

Dave Peterson

James C

Macro to print a selected range, not entire worksheet
 

Guys,

Thanks fot your feedback. I recorded a fresh session and it works fine.
I had a print preview in the first recording that just screwed things
up.

I am all set.

Thanks.

- Jim


--
James C
------------------------------------------------------------------------
James C's Profile: http://www.excelforum.com/member.php...o&userid=12114
View this thread: http://www.excelforum.com/showthread...hreadid=477618



All times are GMT +1. The time now is 06:38 AM.

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