print 3 sheets

KlausW

Active Member
Joined
Sep 9, 2020
Messages
396
Office Version
  1. 2016
Platform
  1. Windows
Hi I would like to print 3 sheets called 1st division, 2nd division. 3rd division, with Range A1 to N40. One side of each. Someone who can help. I use this VBA code.

Any help will be much appreciated.
Many Thanks

Klaus W

VBA Code:
Private Sub cbPrint_Click()
    '
    ' Udskriver bestilling
    '
    Range("A1:N40").Select
    ActiveSheet.PageSetup.PrintArea = "A1:N40"
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate _
    :=True
    End Sub
 
This is more or less the code you used for single sheet printing, changed for multiple sheets.
Code:
Sub Knap2_Klik()
Dim shArr, i As Long, a As String
shArr = Array("1st division", "2nd division", "3rd division", "1st shift", "2. Shift","3. Shift","F-division","T-division")
a = ActiveSheet.Name
Application.ScreenUpdating = False
    For i = LBound(shArr) To UBound(shArr)
        Sheets(shArr(i)).Select
            With ActiveSheet.PageSetup
                .PrintArea = "A1:N40"
                .Zoom = False
                .FitToPagesTall = 1
                .FitToPagesWide = 1
            End With
        ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
    Next i
Sheets(a).Select
Application.ScreenUpdating = False
End Sub
Thanks allot it's work. Greetings from Denmark Klaus W
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,215,842
Messages
6,127,227
Members
449,371
Latest member
strawberrish

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top