How do I print multiple worksheets at the same time?
Two ways to do this. The first way is to select the sheets you want
printed. You do this by the selecting the first sheet you want printed,
then hold down the Ctrl key and select the rest of the sheets you want
printed. Then run this macro:
Sub PrintAll
For Each sh In ActiveWindow.SelectedSheets
'Your print command here
Next
End Sub
The other way is to use a "For" loop through all the sheets and exclude the
ones you don't want printed. That macro looks like this:
Sub AllSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name="ThisSht" Or ws.Name="ThatSht" Then GoTo NextSht
'Your print command here
NextSht:
Next ws
End Sub
HTH Otto
"jd1" wrote in message
...
I have added a command button into my spreadsheet which prints all sheets
at
once. However, I only want to print some of the worksheets. I only know
the
Visual Basic code (ActiveWorkbook.PrintOut) for the entire workbook. Can
anyone tell me the code to print only select worksheets? Thank you.
|