View Full Version : Change Print to 'Landscape'
mferrisi
03-22-2007, 12:24 PM
Does anyone have the line of code to format a sheet to landscape for printing? thank you,
Matt
jolivanes
03-22-2007, 12:43 PM
Hi Matt.
When you tried to do this with the macro recorder, what did it say? Did it not work?
John
I have a button to toggle portrait/landscape:
Sub PrintOrient()
If ActiveSheet.PageSetup.Orientation = xlLandscape Then
ActiveSheet.PageSetup.Orientation = xlPortrait
Else
ActiveSheet.PageSetup.Orientation = xlLandscape
End If
End Sub
mdmackillop
03-23-2007, 02:03 PM
You can simplify the toggle using a With statement
Sub PrintOrient()
With ActiveSheet.PageSetup
If .Orientation = xlLandscape Then
.Orientation = xlPortrait
Else
.Orientation = xlLandscape
End If
End With
End Sub
Thanks. And I know code like that runs faster when there's a lot of it.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.