Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Set Print Area with a macro

I am automating Excel thru Access. I have am exporting a
query to Excel and then formating it to print. Sometimes
I may have 200 records and sometimes I may have 50. I
want to set the print area in the macro. How do I do
this? Does anyone have any code I could use for a jumping
off place?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Set Print Area with a macro

Hi June

If you clear your print area Excel will print all
te records on your sheet



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


"June" wrote in message ...
I am automating Excel thru Access. I have am exporting a
query to Excel and then formating it to print. Sometimes
I may have 200 records and sometimes I may have 50. I
want to set the print area in the macro. How do I do
this? Does anyone have any code I could use for a jumping
off place?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Set Print Area with a macro

I have a feeling that Ron's answer is exactly what you are looking for.

But if you have a sheet with a lot of data and you wish to set
specific print area such that you WILL NOT print all the data (only th
first half, for example)...

then you could use something like:

ActiveSheet.PageSetup.PrintArea = "$A$1:$G$19"

**OR**

Workbooks("Name.xls").Sheets("SheetName").PageSetu p.PrintArea
"$A$1:$G$19

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Set Print Area with a macro

I guess I didn't state my question correctly. I want
Excel to detect the range of cells and set the print area.

Does that make sense?

Thanks,
June


-----Original Message-----
I have a feeling that Ron's answer is exactly what you

are looking for.

But if you have a sheet with a lot of data and you wish

to set a
specific print area such that you WILL NOT print all the

data (only the
first half, for example)...

then you could use something like:

ActiveSheet.PageSetup.PrintArea = "$A$1:$G$19"

**OR**

Workbooks("Name.xls").Sheets

("SheetName").PageSetup.PrintArea =
"$A$1:$G$19"


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

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Set Print Area with a macro

Hi June

If you really want to set the print area

Sub test()
With ActiveSheet
..PageSetup.PrintArea = .UsedRange.Address
End With
End Sub


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


"June" wrote in message ...
I guess I didn't state my question correctly. I want
Excel to detect the range of cells and set the print area.

Does that make sense?

Thanks,
June


-----Original Message-----
I have a feeling that Ron's answer is exactly what you

are looking for.

But if you have a sheet with a lot of data and you wish

to set a
specific print area such that you WILL NOT print all the

data (only the
first half, for example)...

then you could use something like:

ActiveSheet.PageSetup.PrintArea = "$A$1:$G$19"

**OR**

Workbooks("Name.xls").Sheets

("SheetName").PageSetup.PrintArea =
"$A$1:$G$19"


---
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
Defining a print area in a macro Steven Nairn Excel Discussion (Misc queries) 1 January 27th 10 10:35 PM
Variable print area via a macro Andrew Excel Discussion (Misc queries) 9 September 16th 08 09:01 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
Set Print Area Macro Grace[_4_] Excel Programming 9 June 12th 04 03:41 PM


All times are GMT +1. The time now is 03:37 AM.

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

About Us

"It's about Microsoft Excel"