Macro (Print) - Calling Named Ranges

G

Guest

I want to develop Print Macros so as to automate selection and printing of
multiple named ranges within the same sheet. I'm stymied...

Question - How do I call a specific named range? Using the macro I developed
(see below), only the 1st cell in the named range prints.

Example=>> I have a Budget workbook with 5 sheets (2005-2009). Each sheet
has multiples schedules (Income Statement with detail schedules supprting
particular line items). I want to print all schedules at one time, thereby
enhancing efficiency. The attributes of the ranges may change during
developemnt of the workbook, so using absolute attributes are not feasible.

Here's a portion of my macro:

Sub PrintAll()
ActiveSheet.PageSetup.PrintArea = "Schedule1"
Selection.PrintOut Copies:=1, Collate:=True
....
End Sub

This macro works, but I don't want to use specific range attributes:

Sub PrintAll()
ActiveSheet.PageSetup.PrintArea = "$A$161:$E205"
Selection.PrintOut Copies:=1, Collate:=True
....
End Sub

[P.S. I am wanting to switch entirely to Excel from 123 (user since 1984),
but the main obstacle has always been automated print macros. Well, I'm now
close if I can solve this problem.]

Thanks.
 
D

Dave Peterson

Maybe just print the range directly:

ActiveSheet.Range("Schedule1").PrintOut preview:=True

(Remove preview:=true when you're done testing.)

This avoids altering the printarea and selecting anything.
I want to develop Print Macros so as to automate selection and printing of
multiple named ranges within the same sheet. I'm stymied...

Question - How do I call a specific named range? Using the macro I developed
(see below), only the 1st cell in the named range prints.

Example=>> I have a Budget workbook with 5 sheets (2005-2009). Each sheet
has multiples schedules (Income Statement with detail schedules supprting
particular line items). I want to print all schedules at one time, thereby
enhancing efficiency. The attributes of the ranges may change during
developemnt of the workbook, so using absolute attributes are not feasible.

Here's a portion of my macro:

Sub PrintAll()
ActiveSheet.PageSetup.PrintArea = "Schedule1"
Selection.PrintOut Copies:=1, Collate:=True
...
End Sub

This macro works, but I don't want to use specific range attributes:

Sub PrintAll()
ActiveSheet.PageSetup.PrintArea = "$A$161:$E205"
Selection.PrintOut Copies:=1, Collate:=True
...
End Sub

[P.S. I am wanting to switch entirely to Excel from 123 (user since 1984),
but the main obstacle has always been automated print macros. Well, I'm now
close if I can solve this problem.]

Thanks.
 

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