Long time lurker, first time poster
I need help figuring out how to select the visible sheets from an array so that they may be printed while excluding all other sheets, visible or not.
At all times I have at least 1 ws out of an array of 11 visible. I have 2 other ws that are always visible, but will never be printed, for a total of 13 possible ws that can be visible at any time.
Here is what I have so far:
________________________
Sub printselect()
Dim tf As Boolean
tf = True
For Each SH In Worksheets(Array(1, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15))
If SH.Visible Then SH.Select tf << it hangs up here
tf = False
Next
Const xlDialogPrinterSetup = 9
Dim strOld As String
Dim strNew As String
strOld = Application.ActivePrinter
Application.Dialogs(xlDialogPrinterSetup).Show
strNew = Application.ActivePrinter
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOld
End Sub
____________________
It may hang up other places as well, but I haven't been able to get by this as of yet. Any help would be much appreciated. Let me know if you need more info on any part. Thanks!
The Noob
I need help figuring out how to select the visible sheets from an array so that they may be printed while excluding all other sheets, visible or not.
At all times I have at least 1 ws out of an array of 11 visible. I have 2 other ws that are always visible, but will never be printed, for a total of 13 possible ws that can be visible at any time.
Here is what I have so far:
________________________
Sub printselect()
Dim tf As Boolean
tf = True
For Each SH In Worksheets(Array(1, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15))
If SH.Visible Then SH.Select tf << it hangs up here
tf = False
Next
Const xlDialogPrinterSetup = 9
Dim strOld As String
Dim strNew As String
strOld = Application.ActivePrinter
Application.Dialogs(xlDialogPrinterSetup).Show
strNew = Application.ActivePrinter
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.ActivePrinter = strOld
End Sub
____________________
It may hang up other places as well, but I haven't been able to get by this as of yet. Any help would be much appreciated. Let me know if you need more info on any part. Thanks!
The Noob