I have the following code. On some of my tabs, I need to print in portrait and others landscape. I saw some code that did a column count. If the coumn count is less than 10, do portrait, else do landscape.
I wasn't able to get it to work. Any help would be great.
Sub setupSheets()
Dim tempSheet As Worksheet
For Each tempSheet In Worksheets
tempSheet.Activate
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$10"
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveSheet.Cells.Select
Selection.RowHeight = 14
Selection.EntireColumn.AutoFit
Range("A1").Select
Next tempSheet
End Sub
I wasn't able to get it to work. Any help would be great.
Sub setupSheets()
Dim tempSheet As Worksheet
For Each tempSheet In Worksheets
tempSheet.Activate
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$10"
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveSheet.Cells.Select
Selection.RowHeight = 14
Selection.EntireColumn.AutoFit
Range("A1").Select
Next tempSheet
End Sub