Bright01
asked on
Pint Range in Excel
EE Pros,
I'm trying to understand how I can define a range and then have it print from a Macro that identifies all the Ranges in a Workbook. I've attached a simple file with 3 tabs with Ranges to print. How do I define the print area or ranges and then have a Macro that prints them all? What about page breaks?
That's it. Thank you in advance.
B.
Print-Area.xls
I'm trying to understand how I can define a range and then have it print from a Macro that identifies all the Ranges in a Workbook. I've attached a simple file with 3 tabs with Ranges to print. How do I define the print area or ranges and then have a Macro that prints them all? What about page breaks?
That's it. Thank you in advance.
B.
Print-Area.xls
You can try. That would be an easy and simple way.
Unless you have more specification.
Unless you have more specification.
Worksheets("Sheet1").Range("D8:M22").printout
By being specific obviously was a bit more in depth of a simple printout property
I am referring to your comment
and knowing how detailed you are and how precise this sentence left me speechless as to how do you envision a macro to just simply 'identifies all ranges in a workbook' and the workbook you posted has no named ranges and nothing that indicate that something is a range except the yellow colored area that are not enough to indicate a range.
So this respect pls clarify your request.
gowflow
I am referring to your comment
a Macro that identifies all the Ranges in a Workbook.
and knowing how detailed you are and how precise this sentence left me speechless as to how do you envision a macro to just simply 'identifies all ranges in a workbook' and the workbook you posted has no named ranges and nothing that indicate that something is a range except the yellow colored area that are not enough to indicate a range.
So this respect pls clarify your request.
gowflow
ASKER
Gowflow and Wilder1626,
I'm sorry for not being more specific. What I need is a "print" macro that allows me, when the macro is run from a "PRINT BUTTON", to run a set of range names and then have it properly print the ranges in either a PowerPoint or a word format. The yellow areas are only there to signify a area to print. I was going to figure out how to expand the printing area once I saw how it's done.
Hope that helps with clarity.
Thank you,
B.
I'm sorry for not being more specific. What I need is a "print" macro that allows me, when the macro is run from a "PRINT BUTTON", to run a set of range names and then have it properly print the ranges in either a PowerPoint or a word format. The yellow areas are only there to signify a area to print. I was going to figure out how to expand the printing area once I saw how it's done.
Hope that helps with clarity.
Thank you,
B.
ASKER
Wilder and Gowflow,
Quick update. I took Wilder's single line code and it worked (and keeps things simple). My only question to you now is if I'm using range names, what is the syntax for printing multiple range names when running the macro? Thanks for the fast and simple solution.
B.
Quick update. I took Wilder's single line code and it worked (and keeps things simple). My only question to you now is if I'm using range names, what is the syntax for printing multiple range names when running the macro? Thanks for the fast and simple solution.
B.
Do you want to print every sheets on the same page?
an example could be:
Then, you call the printout
an example could be:
Sheets("Sheet1").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$47"
Sheets("Sheet2").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$94"
Sheets(Array("Sheet1", "Sheet2")).Select
ActiveWindow.SelectedSheets.PrintPreview
Sheets("Sheet1").Select
Then, you call the printout
ASKER
I was thinking more like;
Worksheets("Sheet1").Range ("Rangenam e1, Rangename2, Rangename3").printout
Would that work?
B.
Worksheets("Sheet1").Range
Would that work?
B.
Bright01 , i think he wants to print multiple ranges from multiple sheets.
ASKER
I would suspect that if that is the case then;
Sub Print Worksheets
Worksheets("Sheet1").Range ("Rangenam e1, Rangename2, Rangename3").printout
Worksheets("Sheet2").Range ("rangenam e4, rangename5.printout
End Sub
right?
Sub Print Worksheets
Worksheets("Sheet1").Range
Worksheets("Sheet2").Range
End Sub
right?
in the above macro, you run the printout twice. right?
Like this code bellow, you will get a print preview and print only once.
Like this code bellow, you will get a print preview and print only once.
Sheets("Sheet1").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$47"
Sheets("Sheet2").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$94"
Sheets(Array("Sheet1", "Sheet2")).Select
ActiveWindow.SelectedSheets.PrintPreview
Sheets("Sheet1").Select
ASKER
Love it! One last question; how do I control landscape vs. portrait? I have one Worksheet needs to be portrait and one that needs to be landscaped.....
Much thanks!!!!!
B.
Much thanks!!!!!
B.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
only problem is when ranges overspill working on it but hv to go now
gowflow
gowflow
ASKER
Much Thanks to both of you. I modified Wilder's code to work in my WB but after getting gowflow's code, realized that there may be another approach through the drop down selection capability that he has demonstrated for me. You guys are awesome and I really appreciate your work (although my original commentary left a lot of room for interpretation!).
Again, very much appreciate your time. Will be authoring another (simpler) question shortly.
Best regards,
Bright 01
Again, very much appreciate your time. Will be authoring another (simpler) question shortly.
Best regards,
Bright 01
You want what ?
gowflow