Link to home
Start Free TrialLog in
Avatar of ansonindustries
ansonindustriesFlag for United States of America

asked on

Print fixed range in portrait/Landscape

I have a set range
B5:AE102  Need a button to print it in portrait and another button to print in Landscape

how do i do this with VBA?
Avatar of Shanan212
Shanan212
Flag of Canada image

sub PortPrint
         
                  ActiveSheet.PageSetup.Orientation = xlPortrait
                    ActiveSheet.PageSetup.PrintArea = "$B5:AE102"
                    ActiveSheet.PrintOut
end sub

Open in new window


sub landscapePrint
                    ActiveSheet.PageSetup.Orientation = xlLandscape
                    ActiveSheet.PageSetup.PrintArea = "$B5:AE102"
                    ActiveSheet.PrintOut

end sub

Open in new window


Assign these macros to buttons as preferred
Avatar of ansonindustries

ASKER

this works great however i notice that it prints automatically.  Is there a way to have the print setup box open up where the user can select a printer and then print?
ASKER CERTIFIED SOLUTION
Avatar of Shanan212
Shanan212
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
works great! thanks your awesome!
Glad that helped :)