Printing multiple sheets from a macro

  • Thread starter Thread starter Taylor Francis
  • Start date Start date
T

Taylor Francis

How do I print multiple sheets from a macro. I don't want to select
them individually and print them individually, but rather choose
multiple sheets and print them with one print call so they end up as one
print job...

Thanks
Taylor
 
Try

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

ActiveWindow.SelectedSheets.PrintOut
'print all selected sheets
 
I want to print the first sheet, and then the 3rd - end sheets, with no
set number of sheets...
do i need (how do i use) a dynamic array?
 
Hi Taylor
Do I understand you correct that you want to print all sheets except the second sheet.
 
One way:

Option Explicit
Sub testme02()

Dim mySheetNames() As String
Dim wksCtr As Long
Dim iCtr As Long

ReDim mySheetNames(1 To Worksheets.Count - 1)

iCtr = 0
For wksCtr = 1 To Worksheets.Count
If wksCtr = 2 Then
'do nothing
Else
iCtr = iCtr + 1
mySheetNames(iCtr) = Worksheets(wksCtr).Name
End If
Next wksCtr

If iCtr = 0 Then
MsgBox "nothing selected"
Else
Worksheets(mySheetNames).PrintPreview '.printout
End If

End Sub
 
Back
Top