Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell value determined by the current time and date jschae Excel Worksheet Functions 4 June 12th 09 01:45 PM
How do you have a formula range be determined by the location ofanother cell? Daniel[_3_] Excel Worksheet Functions 2 February 8th 08 03:01 PM
Saving a pre-determined range of cells as text? [email protected] Excel Discussion (Misc queries) 2 March 27th 07 11:58 PM
How do I run a macro when a pre-determined time has been reached . NAMATA Excel Discussion (Misc queries) 1 April 19th 06 08:12 PM
Determined if filtered range is empty Fred Smith Excel Programming 5 February 22nd 04 03:54 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"