print 3 sheets

KlausW

Board Regular
Joined
Sep 9, 2020
Messages
72
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
 

KlausW

Board Regular
Joined
Sep 9, 2020
Messages
72
Office Version
  1. 2016
Platform
  1. Windows
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
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Watch MrExcel Video

Forum statistics

Threads
1,127,870
Messages
5,627,362
Members
416,245
Latest member
Xterminat

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
Top