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


I'm new to VBA and have a problem. Each month I create a cvs file for
monthy warranty claims. I open this with Excel. Then I create 13
different reports using Autofilter. Everthing I've done works like a
charm except setting the print area. No matter how I arrive at the print
range, the macro uses the print area ranges (see next 3 lines)
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$55"
This works fine for this month but next month all the reports will be
different sizes. The fact that the macro defines the "Print Area" makes
it useless for the following months.
Is there any way to get around this?
Thanks in advance

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Setting the Print Area in a macro.

Dick,
Maybe this is what you are trying to do?...

ActiveSheet.PageSetup.PrintArea = Selection.Address

Jim Cone
San Francisco, USA


"Dick Snow" wrote in message ...

I'm new to VBA and have a problem. Each month I create a cvs file for
monthy warranty claims. I open this with Excel. Then I create 13
different reports using Autofilter. Everthing I've done works like a
charm except setting the print area. No matter how I arrive at the print
range, the macro uses the print area ranges (see next 3 lines)
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$55"
This works fine for this month but next month all the reports will be
different sizes. The fact that the macro defines the "Print Area" makes
it useless for the following months.
Is there any way to get around this?
Thanks in advance

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting the Print Area in a macro.


Jim Cone,
What a timely and most welcome reply. Your answer corrected my
problem. I have 4 books that I'm learning from and none gave me the
information I needed. You're greatly appreaciated.
Thank you.


*** Sent via Developersdex http://www.developersdex.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
Setting The Print-Area ? Robert11[_3_] New Users to Excel 2 May 31st 09 03:24 PM
Setting print area richzip Excel Discussion (Misc queries) 1 April 27th 08 08:10 AM
setting the print area from a macro Joe Farruggio Excel Worksheet Functions 10 November 25th 06 01:10 AM
Macro script for setting Print Area JB2010 Excel Discussion (Misc queries) 3 January 12th 06 06:05 PM
Setting Print Area Defoes Right Boot Excel Programming 3 May 18th 05 12:26 PM


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

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"