VBA Printing

E

EMoe

Hello Programmers! :)

Below is a simple code (that I've recorded) to print the selected range
from 3 different worksheets. I know that all printers are different, but
the standard functions should be the same.

First of all, is there a way to simplify this code. Secondly, how do
you write in a code to, #1. Print the selected sheets in reverse order,
#2. and to rotate the sheets 180 degrees. I tried to record these
actions but they don't show up in the code. Are there some codes out
there for this, or is this a feature set up within the printers
software? :confused:

Sub PrintWorksheets()
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("A1").Select
Sheets("Sheet2").Select
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("A1").Select
Sheets("Sheet3").Select
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True
Range("A1").Select
Sheets("Sheet1").Select
Range("A1").Select
End Sub

Thanks,
EMoe
 
D

DataCollector

First, under the File Menu, choose Page Setup, Page and select Landscap
view.
Second, in your code, move Sheet 3 into the first position, leave Shee
2 where it is, and move Sheet1 into the third position.

Sub PrintWorksheets()
Sheets("Sheet3").Select
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True

Sheets("Sheet2").Select
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True

Sheets("Sheet1").Select
Range("A1:I52").Select
Selection.PrintOut Copies:=1, Collate:=True

'leaving this code here makes sure the first page is selected whe
printing finishes
'you don't really need it.
Sheets("Sheet1").Select
Range("A1").Select

End Su
 
D

Don Guillett

One way. You could also do a for i=1 to three and do for each sh

See if this works then change printpreview to printout
Sub loopthrusheetarray()
Dim Sh As Worksheet
For Each Sh In Sheets(Array("Sheet1", "Sheet2", "Sheet3"))
sh.range("a1:i52").printpreview
Next
End Sub
 
E

EMoe

Hi Don!

Sorry it took me a while to get back to you. I just tried your
*efficient code*, and it works well. Now I see how to shorten my print
code, and I'll use this method in future programs.

Thanks,
EMoe :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top