Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Print fixed range in portrait/Landscape

Posted on 2013-01-14
5
Medium Priority
?
490 Views
Last Modified: 2013-01-14
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?
0
Comment
Question by:ansonindustries
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Shanan212
ID: 38775429
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
 

Author Comment

by:ansonindustries
ID: 38775725
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
 
LVL 13

Accepted Solution

by:
Shanan212 earned 2000 total points
ID: 38775765
instead of

activesheet.printout

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

Application.Dialogs(xlDialogPrint).Show
0
 

Author Closing Comment

by:ansonindustries
ID: 38775819
works great! thanks your awesome!
0
 
LVL 13

Expert Comment

by:Shanan212
ID: 38776019
Glad that helped :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question