Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JB2010
 
Posts: n/a
Default Macro script for setting Print Area

Hi

Can someone list the full script i would need for a macro that would
highlight all the non blank cells of a worksheet & set that as the print area.

I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift Down
then Control+Shift Right, but the resulting script is still specific to the
cell references of the sheet i used to record on.

I do not know how to program it for just all active cells regardless of what
they are, from sheet to sheet.

Any help gratefully recieved.


Cheers


jb
  #2   Report Post  
Posted to microsoft.public.excel.misc
Colin Sandall
 
Posts: n/a
Default Macro script for setting Print Area

JB,

This: Selection.CurrentRegion.Select

Will select the current region providing that there are no entire rows or
columns blank, i.e. it will select from the cell uppermost and to the left
and bottommost and to the right before the next blank columns and rows.

Regards

Colin
"JB2010" wrote in message
...
Hi

Can someone list the full script i would need for a macro that would
highlight all the non blank cells of a worksheet & set that as the print
area.

I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift
Down
then Control+Shift Right, but the resulting script is still specific to
the
cell references of the sheet i used to record on.

I do not know how to program it for just all active cells regardless of
what
they are, from sheet to sheet.

Any help gratefully recieved.


Cheers


jb



  #3   Report Post  
Posted to microsoft.public.excel.misc
Colin Sandall
 
Posts: n/a
Default Macro script for setting Print Area

I forgot to add:

Sheets ("xxx").Select
Range("A1").Select (Assuming data starts here)
Selection.CurrentRegion.Select

Colin
"JB2010" wrote in message
...
Hi

Can someone list the full script i would need for a macro that would
highlight all the non blank cells of a worksheet & set that as the print
area.

I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift
Down
then Control+Shift Right, but the resulting script is still specific to
the
cell references of the sheet i used to record on.

I do not know how to program it for just all active cells regardless of
what
they are, from sheet to sheet.

Any help gratefully recieved.


Cheers


jb



  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Macro script for setting Print Area

Maybe:

With ActiveSheet
.PageSetup.PrintArea = .Range("A1").CurrentRegion.Address
end with

JB2010 wrote:

Hi

Can someone list the full script i would need for a macro that would
highlight all the non blank cells of a worksheet & set that as the print area.

I have tried recording my own, basically; highlight Cell A1, Ctrl+Shift Down
then Control+Shift Right, but the resulting script is still specific to the
cell references of the sheet i used to record on.

I do not know how to program it for just all active cells regardless of what
they are, from sheet to sheet.

Any help gratefully recieved.

Cheers

jb


--

Dave Peterson
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
Macro to include Close Print Preview Vic Charts and Charting in Excel 1 January 9th 06 01:06 AM
Extra Row in Defined Print Area Harry Gordon Excel Discussion (Misc queries) 3 November 14th 05 03:06 AM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Printing - Have to set print area 1 column further than necessary STUART BISSET Excel Discussion (Misc queries) 0 January 24th 05 07:59 PM
Changing print area Aaron Excel Discussion (Misc queries) 2 January 9th 05 05:58 PM


All times are GMT +1. The time now is 08:12 PM.

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"