Solved

Print fixed range in portrait/Landscape

Posted on 2013-01-14
5
470 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
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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

840 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