ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Print Array for hidden sheets using VBA (https://www.excelbanter.com/excel-discussion-misc-queries/79779-print-array-hidden-sheets-using-vba.html)

Ant

Print Array for hidden sheets using VBA
 
Is it possible to print multiple hidden sheets using the array function in
VBA? Currently my code opens them all up, prints, then closes them. However
this is quite slow and I don't really need, or want, to see the sheets.
Something like...

With Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", _
"Sheet5", "Sheet6", "Sheet7"))
.PrintOut Copies:=1
End With

Thanks in advance



broro183

Print Array for hidden sheets using VBA
 

Hi Ant,
First up I'd add the 2 lines below to the start of your code & the
respective "true" lines after your code:
Application.ScreenUpdating = False
Application.DisplayAlerts = False

If this doesn't help/speed it up enough, have a look at Ron Debruin's
page (I don't know how fast this technique is, as I have no printer at
home):
http://www.rondebruin.nl/print.htm#visible

Ron shows the use of an array in the "one liner code" near the base of
his page which suggests you were very close/have the solution. He
doesn't use a "with" construct (see below) but I don't know if it would
work on hidden sheets:

Sheets(Array("Sheet1", "Sheet3")).PrintOut
'all sheets in the array



Hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=526672



All times are GMT +1. The time now is 09:45 PM.

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