Hello Excel Warriors!
I have a workbook with let's say three sheets: A, B, and C. Within them each one has three different named print areas: let's say A1,A2, and A3 - B1, B2, and B3, C1, C2, and C3.
I would like to pass on to a kind of function or sub the variables "Sheet" and "Area", something like:
Sheet = Range("Z1")
Area = Range("Z2")
Sub MacroforPrinting(Sheet,Area)
Active.Sheet = Sheet
PrintArea = Area
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
Of course the above macro does NOT work. Can somebody help me out?
This sub will be inside a much larger code.
Thanks!
I have a workbook with let's say three sheets: A, B, and C. Within them each one has three different named print areas: let's say A1,A2, and A3 - B1, B2, and B3, C1, C2, and C3.
I would like to pass on to a kind of function or sub the variables "Sheet" and "Area", something like:
Sheet = Range("Z1")
Area = Range("Z2")
Sub MacroforPrinting(Sheet,Area)
Active.Sheet = Sheet
PrintArea = Area
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
Of course the above macro does NOT work. Can somebody help me out?
This sub will be inside a much larger code.
Thanks!