LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Automatic print area

When i try i have an error on Cells (a1,Lastrow)
Why?
Thanks

-----Original Message-----
If you don't set the print area, Excel should

automatically print the whole
page - an it should handle hidden rows automatically as

well - so no code
should be required if you remove the print area in

insert=Names=define.

but, if you only want to print column A

Sub print()

LastRow = Range("a65000").End(xlUp).Offset(1, 5)
Cells(A1, LastRow).Select

ActiveSheet.PageSetup.PrintArea = "$A$1:A" & LastRow"
Selection.PrintOut Copies:=1, Collate:=True

But it appears you might want to print 5 columns

ActiveSheet.PageSetup.PrintArea = "$A$1:E" & LastRow"


Regards,
Tom Ogilvy


"Peter" wrote in message
...
Hi,
i have an area to print. It always is not equal, does
every time depend on the extraction of the data that
youare filtered in the report, I have a base of the code
here, as does it have to be correct? Thanks in

advance.Pit


Sub print()
LastRow = Range("a65000").End(xlUp).Offset(1, 5).Select
Cells(A1, LastRow).Select

ActiveSheet.PageSetup.PrintArea = "$A$1:LastRow"
Selection.PrintOut Copies:=1, Collate:=True

End Sub



.

 
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
set area in excel not giving me option to set print area? J Littlebear Excel Discussion (Misc queries) 4 April 23rd 23 09:04 PM
File, print area, clear area, is not working cblind New Users to Excel 2 September 12th 07 04:51 PM
print area across the freeze panes area tom Excel Worksheet Functions 2 January 6th 07 05:23 PM
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
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM


All times are GMT +1. The time now is 11:14 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"