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

I have a sheet which can have anything between approx 50 or 100 rows of data,
controlled by formulae which will leave the cells blank where no data is
required. I want to print it all on one page but am having problems with
leaving large blank areas at the bottom of the page if a low number of rows
are shown.

Rather than always setting the print area to the maximum that will ever be
required I want my macro to set the print area to show only the non-blank
rows. As some cells within the range are blank anyway I can't simply count
the non-blank cells and do it that way.

Any ideas? (I'm not very good at programming so if you could explain any
solutions I would be very grateful!)

Thanks

Phil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting Print Area

Hi Phil,

These three lines of code put an autofilter on the used range, filters
the first column for non-blank values, prints the visible values and
turns the autofilter off again.

ActiveSheet.UsedRange.AutoFilter Field:=1, Criteria1:="<"
ActiveSheet.PrintOut
ActiveSheet.UsedRange.AutoFilter

With kind regards,
Ton Teuns

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

Thanks Ton

Unfortunately this won't work as some required rows have a blank first cell.
There are no columns which will always be non-blank in all the required rows
so can't use this method.

Thanks anyway.
Phil

"ton teuns" wrote:

Hi Phil,

These three lines of code put an autofilter on the used range, filters
the first column for non-blank values, prints the visible values and
turns the autofilter off again.

ActiveSheet.UsedRange.AutoFilter Field:=1, Criteria1:="<"
ActiveSheet.PrintOut
ActiveSheet.UsedRange.AutoFilter

With kind regards,
Ton Teuns

*** Sent via Developersdex http://www.developersdex.com ***

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Setting Print Area

Just realised I can insert a new column A with white text, use that to check
the whole row for non-blank cells and filter on that - works a treat!

Thanks!

"Defoes Right Boot" wrote:

Thanks Ton

Unfortunately this won't work as some required rows have a blank first cell.
There are no columns which will always be non-blank in all the required rows
so can't use this method.

Thanks anyway.
Phil

"ton teuns" wrote:

Hi Phil,

These three lines of code put an autofilter on the used range, filters
the first column for non-blank values, prints the visible values and
turns the autofilter off again.

ActiveSheet.UsedRange.AutoFilter Field:=1, Criteria1:="<"
ActiveSheet.PrintOut
ActiveSheet.UsedRange.AutoFilter

With kind regards,
Ton Teuns

*** 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 Print Area dolppm Excel Programming 2 March 8th 05 09:35 PM
Setting print area with vba KimberlyC Excel Programming 3 December 18th 04 12:46 AM
SETTING PRINT AREA IN VBA Frankie[_2_] Excel Programming 6 June 24th 04 03:11 PM


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