Select Visible sheets

J

Jason Morin

Sub PrintVisibleSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible Then
ws.PrintOut Copies:=1, Collate:=True
End If
Next
End Sub
 
T

Tom Ogilvy

If you want them as one print job:

Sub SelectVisible()
Dim bReplace as Boolean, sh as worksheet
Dim shActive as worksheet
set shActive = Activesheet
bReplace = True
For Each sh In ThisWorkbook.Worksheets
If sh.Visible Then
sh.Select bReplace
bReplace = False
End If
Next
ActiveWindow.SelectedSheets.PrintOut
shActive.select
End Sub
 
D

Darin Kramer

Thanks Perfect! - Forgot to ask...if I want to exclude a specifically
named sheet (say called Contents) is that also possible?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

Tom Ogilvy

If your happy with multiple print jobs rather than what you asked then:

Sub PrintVisibleSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible Then
if ws.Name <> "Contents" then
ws.PrintOut Copies:=1, Collate:=True
end if
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top