VBA Printing in ranges in multipul tabs to printer

rpike1221

New Member
Joined
Mar 17, 2013
Messages
3
I am new to the world of VBA. Just trying to print selected areas of tabs in a workbook. So far I have the following however I am getting an error at the first line... I am a little lost at where to start.
I am happy for the pages to print one after each other to the printer or collate then print as one document (if possible) Just cant figure out where i am going wrong.

Any help would be much appreciated...



Sub Weekly_Compliance_Print()
'
' Weekly_Compliance_Print Macro
'
'
Sheets("Banks Asset Allocation Summary").Select
Range("B1:N40").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
ActiveWindow.SmallScroll Down:=-21
Range("P1:Y27").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Banks Asset Allocation Summary").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Manager weights").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Manager Weightings").Select
ActiveWindow.SmallScroll Down:=-12
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Manager Fees").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Columns("Y:AG").Select
Range("Y3").Activate
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Compliance monitor").Select
Selection.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi rpike1221,

The macro recorder is a good place to start but can give very inefficient code. See if the following works for you.

Code:
Sub test()
With Sheets("Banks Asset Allocation Summary")
    .PageSetup.PrintArea = .Range("B1:N40")
    .PrintOut
    .PageSetup.PrintArea = .Range("P1:Y27")
    .PrintOut
End With
Sheets("Manager weights").PrintOut
Sheets("Manager Weightings").PrintOut
Sheets("Manager Fees").PrintOut
Sheets("Compliance monitor").PrintOut
End Sub
 
Upvote 0
Thank you for your help with this. I have made a few changes and so far have the below. Obviously I am missing something because it is not running ! Coming up with Run-Time Error 1004 - which i am guessing has something to do with defining the active sheet ??

Please see below !

Sub test()
With Sheets("Bank 1 Asset Allocation Summary")
.PageSetup.PrintArea = .Range("B1:N40")
.PrintOut
.PageSetup.PrintArea = .Range("P1:Y27")
.PrintOut
End With
With Sheets("Bank 2 Asset Allocation Summary")
.PageSetup.PrintArea = .Range("B1:N47")
.PrintOut
End With
With Sheets("Bank 3 Asset Allocation Summary")
.PageSetup.PrintArea = .Range("B1:K47")
End With
Sheets("Manager weights").PrintOut
Sheets("Manager Weightings").PrintOut
With Sheets("Manager Fees").PrintOut
.PageSetup.PrintArea = .Range("N1:Y106")
.PrintOut
.PageSetup.PrintArea = .Range("AA1:AI103")
.PrintOut
.PageSetup.PrintArea = .Range("AK:AS101")
.PrintOut
End With
Sheets("Compliance monitor").PrintOut
End Sub

thank you !!!
RP
 
Upvote 0
The line below appears to be in error. You shouldn't have .printout on it.

With Sheets("Manager Fees").PrintOut

Please use [ code ] and [ /code ] tags when inserting blocks of code as it makes it easier to follow. See BB Code List - MrExcel Message Board for details.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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