![]() |
Macro (Print) - Calling Named Ranges
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. |
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. KGlennC wrote: 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. -- Dave Peterson |
All times are GMT +1. The time now is 03:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com