looping thru sheets for printing.

  • Thread starter Thread starter Pal
  • Start date Start date
P

Pal

I am trying to print page 1 & 2 of a 4 page worksheet.
But I have have 25 worksheets.
I ran the following code but it printed multiple copies of the first sheet.
So it never looped to the next sheet.
Any ideas?
Thanks
Pal


Sub Print_All()
Dim sht As Variant

For Each sht In ThisWorkbook.Sheets
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1,
Collate:=True
Next sht

End Sub
 
Sub Print_All()
Dim sht As Variant

For Each sht In ThisWorkbook.Sheets
sht.PrintOut From:=1, To:=2, Copies:=1,
Collate:=True
Next sht

End Sub
 
That's because you're telling it to print out only the selected sheets
in the active window as many times as you have sheets in the workbook.


Try:

Dim sht As Worksheet
For Each sht In ActiveWindow.SelectedSheets
sht.PrintOut
Next sht
 

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

Back
Top