Hi everyone! I'm trying to apply print settings to certain sheets in a workbook (all but the 2 listed in the code below -Summary and ARO tabs). When I run the code, it stays on the first tab (Summary) and applies the hide columns command which this should only be applied to the sheets I'm setting the print areas.
Sub FormatSheets()
Dim ws As Worksheet
ws.Activate
For Each ws In ActiveWorkbook.Worksheets
Select Case ws.Name
Case "Summary", "ARO"
Case Else
With ws.PageSetup
.PrintTitleRows = "$1:$1"
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
End With
ws.Cells.Select
Selection.WrapText = True
Selection.ColumnWidth = 10
Selection.EntireRow.AutoFit
Range("A:A,U:U,W:W,Y:Y,Z:Z,AE:AE,AG:AG,AI:AI,AJ:AJ,AP:AP").EntireColumn.Hidden = True
End Select
Next ws
End Sub
I'd appreciate any help!
Bookmarks