Solved

Print fixed range in portrait/Landscape

Posted on 2013-01-14
5
440 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
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Shanan212
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
works great! thanks your awesome!
0
 
LVL 13

Expert Comment

by:Shanan212
Comment Utility
Glad that helped :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now