ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing a range that is determined at run time (https://www.excelbanter.com/excel-programming/298972-printing-range-determined-run-time.html)

Michel Pilon

Printing a range that is determined at run time
 
Hi everyone,

I have a problem with the following code

LINE 1: Dim MyRange As Range
LINE 2: Set MyRange = Range("A7",[A7].End(xlDown))
LINE 3: ActiveSheet.PageSetup.PrintArea = MyRange

LINE 3 does not work. MyRange is not accepted for specifying a range.

Can anyone help me?

Thanks

Ron de Bruin

Printing a range that is determined at run time
 
Use MyRange.Address

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Michel Pilon" wrote in message m...
Hi everyone,

I have a problem with the following code

LINE 1: Dim MyRange As Range
LINE 2: Set MyRange = Range("A7",[A7].End(xlDown))
LINE 3: ActiveSheet.PageSetup.PrintArea = MyRange

LINE 3 does not work. MyRange is not accepted for specifying a range.

Can anyone help me?

Thanks




FastOneBaz[_2_]

Printing a range that is determined at run time
 
Range("A7").select

Range(Selection, Selection.End(xlDown)).Select

Selection.PrintOut Copies:=1, Preview:=False, Collate:=Tru

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Printing a range that is determined at run time
 
Hi Michel,

Try this

Dim MyRange As Range

Set MyRange = Range("A7:" & Range("A7").End(xlDown).Address)
ActiveSheet.PageSetup.PrintArea = MyRange

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michel Pilon" wrote in message
m...
Hi everyone,

I have a problem with the following code

LINE 1: Dim MyRange As Range
LINE 2: Set MyRange = Range("A7",[A7].End(xlDown))
LINE 3: ActiveSheet.PageSetup.PrintArea = MyRange

LINE 3 does not work. MyRange is not accepted for specifying a range.

Can anyone help me?

Thanks





All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com