Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Print only down to last occupied row

Need a little help please guys, I have a worksheet that, after running
filters, presents me with the data I actually need. Trouble is the list
varies in length on each run. It's a pain to keep manually changing the
print area. Can anyone help with a routine to set the print area down to the
last "occupied" row?

Any help greatly appreciated.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Print only down to last occupied row

On 25 Nov., 11:46, "mepetey" wrote:
Need a little help please guys, I have a worksheet that, after running
filters, presents me with the data I actually need. Trouble is the list
varies in length on each run. It's a pain to keep manually changing the
print area. Can anyone help with a routine to set the print area down to the
last "occupied" row?

Any help greatly appreciated.


Put the code in the codesheet for ThisWorkbook.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
FirstCell = "A1"
LastCell = Range("A1").End(xlDown).End(xlToRight).Address
ActiveSheet.PageSetup.PrintArea = Range(FirstCell, LastCell).Address
End Sub

Regards,

Per
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Print only down to last occupied row

Thanks for the fast response, how do I limit the print from column A to
column I?


"Per Jessen" wrote in message
...
On 25 Nov., 11:46, "mepetey" wrote:
Need a little help please guys, I have a worksheet that, after running
filters, presents me with the data I actually need. Trouble is the list
varies in length on each run. It's a pain to keep manually changing the
print area. Can anyone help with a routine to set the print area down to
the
last "occupied" row?

Any help greatly appreciated.


Put the code in the codesheet for ThisWorkbook.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
FirstCell = "A1"
LastCell = Range("A1").End(xlDown).End(xlToRight).Address
ActiveSheet.PageSetup.PrintArea = Range(FirstCell, LastCell).Address
End Sub

Regards,

Per



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Print only down to last occupied row

Cracked it. Thanks !

"mepetey" wrote in message
...
Thanks for the fast response, how do I limit the print from column A to
column I?


"Per Jessen" wrote in message
...
On 25 Nov., 11:46, "mepetey" wrote:
Need a little help please guys, I have a worksheet that, after running
filters, presents me with the data I actually need. Trouble is the list
varies in length on each run. It's a pain to keep manually changing the
print area. Can anyone help with a routine to set the print area down to
the
last "occupied" row?

Any help greatly appreciated.


Put the code in the codesheet for ThisWorkbook.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
FirstCell = "A1"
LastCell = Range("A1").End(xlDown).End(xlToRight).Address
ActiveSheet.PageSetup.PrintArea = Range(FirstCell, LastCell).Address
End Sub

Regards,

Per





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Print only down to last occupied row

Range(Range("A1"), ActiveCell.SpecialCells(xlLastCell)).Select
ActiveSheet.PageSetup.PrintArea = Selection.Address


"mepetey" skrev:

Need a little help please guys, I have a worksheet that, after running
filters, presents me with the data I actually need. Trouble is the list
varies in length on each run. It's a pain to keep manually changing the
print area. Can anyone help with a routine to set the print area down to the
last "occupied" row?

Any help greatly appreciated.







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
Room Occupied Checker Formula Help Dax Arroway Excel Worksheet Functions 5 December 1st 09 12:14 AM
newbie - how to paste into an occupied cell Vic Baron New Users to Excel 5 June 5th 08 07:52 PM
Find next occupied row up in another column Greg Lovern Excel Worksheet Functions 9 November 17th 07 03:19 AM
Selecting occupied cell over empty ones Rich Excel Discussion (Misc queries) 0 March 28th 07 02:53 AM
Selecting occupied cell over empty ones Teethless mama Excel Discussion (Misc queries) 1 March 28th 07 02:13 AM


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