Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Setting up a variable print range

I am looking for an easy way to use a macro to select a
print range by determining the last row and column used.
However, the last row and column used will change between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Setting up a variable print range

Hi Gary

Did you not see your other thread
You get a couple possible solutions there

(Posted private also)

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Gary" wrote in message ...
I am looking for an easy way to use a macro to select a
print range by determining the last row and column used.
However, the last row and column used will change between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
Tod Tod is offline
external usenet poster
 
Posts: 13
Default Setting up a variable print range

What exactly do you mean when you say 'last row and column
used'?

A quick and dirty way is:
Range("A1:" & Range("A1").CurrentRegion.SpecialCells
(xlCellTypeLastCell).Address).PrintOut

This uses A1 to find the set of contiguous values that
make up the table of data and then prints A1 through the
cell that is in the last row and last column.

tod
-----Original Message-----
I am looking for an easy way to use a macro to select a
print range by determining the last row and column used.
However, the last row and column used will change

between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting up a variable print range

One more possible method:

ActiveSheet.PageSetup.PrintArea = _
ActiveSheet.UsedRange.Address

Provided you save your workbook before running this code,
this would grab the smallest rectangular area of cells
that contain any data.

-----Original Message-----
I am looking for an easy way to use a macro to select a
print range by determining the last row and column used.
However, the last row and column used will change

between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Setting up a variable print range

For example, if I enter data in a spreadsheet where I am
only using the range from A1 to L98, I want to be able to
select that range and print it. Maybe next time I use the
spreadsheet I only use the Range A1 to L16, I would like
to print only that range.

Gary

-----Original Message-----
What exactly do you mean when you say 'last row and

column
used'?

A quick and dirty way is:
Range("A1:" & Range("A1").CurrentRegion.SpecialCells
(xlCellTypeLastCell).Address).PrintOut

This uses A1 to find the set of contiguous values that
make up the table of data and then prints A1 through the
cell that is in the last row and last column.

tod
-----Original Message-----
I am looking for an easy way to use a macro to select a
print range by determining the last row and column

used.
However, the last row and column used will change

between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary


.

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting up a variable print range

ActiveSheet.PageSetup.PrintArea = _
Range("A1").CurrentRegion.Address(external:=true)

Put it in the BeforePrint event.

Regards,
Tom Ogilvy

Gary wrote in message
...
I am looking for an easy way to use a macro to select a
print range by determining the last row and column used.
However, the last row and column used will change between
users. For example, if the user only used up to row 98

and
column L is the last column used. I need to select the
range A1 to L98 and print this range. Thanks for any

input.

gary




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
Using named range to extend print area for variable number of columns Pierre Excel Worksheet Functions 3 April 10th 08 05:51 PM
Setting print range using VBA Dave Ramage[_2_] Excel Programming 0 July 29th 03 04:35 PM
Setting print range using VBA VBANut Excel Programming 0 July 29th 03 04:20 PM
Setting print range using VBA Ron de Bruin Excel Programming 0 July 29th 03 03:59 PM
Setting Print range Tom Ogilvy Excel Programming 3 July 25th 03 04:06 AM


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