?
Solved

Print fixed range in portrait/Landscape

Posted on 2013-01-14
5
Medium Priority
?
492 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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