Dreamteam
New Member
- Joined
- Feb 22, 2018
- Messages
- 28
- Office Version
- 365
- Platform
- Windows
Hi guys,
I have the following code that runs through multiple sheets creating a named range/print area - to fit to one sheet in readiness for printing. It is successfully creating the print area/named range on each sheet (that has a numerical name) but it is not setting it up for printing on one sheet. I have been on this for ages and I must be missing something relatively simple? Maybe not?
Any help much appreciated.
Many thanks
Dt
Sub CreatePrint_Area()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim ws As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
For Each ws In wb.Worksheets
If IsNumeric(ws.Name) Then
With ActiveSheet.PageSetup
.PrintArea = "$a$1:$z$71"
.Orientation = xlPortrait
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End If
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
I have the following code that runs through multiple sheets creating a named range/print area - to fit to one sheet in readiness for printing. It is successfully creating the print area/named range on each sheet (that has a numerical name) but it is not setting it up for printing on one sheet. I have been on this for ages and I must be missing something relatively simple? Maybe not?
Any help much appreciated.
Many thanks
Dt
Sub CreatePrint_Area()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim ws As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
For Each ws In wb.Worksheets
If IsNumeric(ws.Name) Then
With ActiveSheet.PageSetup
.PrintArea = "$a$1:$z$71"
.Orientation = xlPortrait
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End If
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub