excelmacro
Board Regular
- Joined
- Apr 8, 2002
- Messages
- 50
This macro is to print out certain ranges on a sheet on different pages, and i have a button on each sheet to print that sheet, but the macro only works for one sheet. Any suggestions with what is wrong in this coding?
Sub PrintMacro()
Range("A1:K38").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.FitToPagesWide = 1
.FitToPagesTall = 1
Application.Dialogs
(xlDialogPrinterSetup).Show
End With
ActiveWindow.SmallScroll Down:=22
Range("A39:C66").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("A67:C84").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.LargeScroll Down:=-3
Range("A1:K38").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.SmallScroll ToRight:=10
ActiveWindow.LargeScroll Down:=-1
Range("L1:V32").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.LargeScroll Down:=-1
Range("X1:Z40").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1, Collate:=True
Range("A1:A2").Select
End Sub
Sub PrintMacro()
Range("A1:K38").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.FitToPagesWide = 1
.FitToPagesTall = 1
Application.Dialogs
(xlDialogPrinterSetup).Show
End With
ActiveWindow.SmallScroll Down:=22
Range("A39:C66").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("A67:C84").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.LargeScroll Down:=-3
Range("A1:K38").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.SmallScroll ToRight:=10
ActiveWindow.LargeScroll Down:=-1
Range("L1:V32").Select
Selection.PrintOut Copies:=1, Collate:=True
ActiveWindow.LargeScroll Down:=-1
Range("X1:Z40").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1, Collate:=True
Range("A1:A2").Select
End Sub