ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print a sheet without ever selecting the sheet (https://www.excelbanter.com/excel-programming/356007-print-sheet-without-ever-selecting-sheet.html)

sharkfoot

Print a sheet without ever selecting the sheet
 

I have a worksheet titled TNT and in this worksheet, I have a button to
print the print area of a sheet that is titled Variables.


Code:
--------------------
Sub PrintVariables()

Sheets("Variables").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("TNT").Select
End Sub

--------------------


I recorded the above macro simply enough, but what I want is to print
the Variables tab without ever selecting the variables tab like it
currently does.

In other words, I want the button that runs this macro to print the
Variables tab without ever leaving the TNT tab.

How do I make the rquired changes?


--
sharkfoot
------------------------------------------------------------------------
sharkfoot's Profile: http://www.excelforum.com/member.php...o&userid=32164
View this thread: http://www.excelforum.com/showthread...hreadid=522334


davesexcel[_68_]

Print a sheet without ever selecting the sheet
 

try
application.screenupdating=false
before
Sheets("Variables").Select


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=522334


sharkfoot[_2_]

Print a sheet without ever selecting the sheet
 

Works perfectly. Thank you very much!


--
sharkfoot
------------------------------------------------------------------------
sharkfoot's Profile: http://www.excelforum.com/member.php...o&userid=32164
View this thread: http://www.excelforum.com/showthread...hreadid=522334


Tom Ogilvy

Print a sheet without ever selecting the sheet
 
Sub PrintVariables()
Sheets("Variables").Printout
End Sub

--
Regards,
Tom Ogilvy


"sharkfoot" wrote
in message ...

Works perfectly. Thank you very much!


--
sharkfoot
------------------------------------------------------------------------
sharkfoot's Profile:

http://www.excelforum.com/member.php...o&userid=32164
View this thread: http://www.excelforum.com/showthread...hreadid=522334





All times are GMT +1. The time now is 04:51 AM.

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