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?
ansonindustriesAsked:
Who is Participating?
 
Shanan212Connect With a Mentor Commented:
instead of

activesheet.printout

^ delete that line and insert this on both sets of code

Application.Dialogs(xlDialogPrint).Show
0
 
Shanan212Commented:
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
0
 
ansonindustriesAuthor Commented:
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?
0
 
ansonindustriesAuthor Commented:
works great! thanks your awesome!
0
 
Shanan212Commented:
Glad that helped :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.