Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Another Print Area question

I have a spreadsheet that has a varying number of rows to print depending on
the amount of data. The columns are standard A:F but the rows could be 3 or
33. I have had a couple of goes but can't get it to play. Columns F have
data but don't print.

The cells after the last non blank have formulas that return "".

So, what I need is a code that will set the print area as A1:the last non
blank cell in Column F but not detect the formulas returning "" below the
last non blank.

Currently I have the print settings set to return [page]of[pages] as a
footer and A1:F1 at the top of each page. Am I correct in assuming that
specifying the print area won't alter those settings?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Another Print Area question

hi
if i understand you correctly, this should work for you. if not, play with
the offsets.
Dim r As Range
Set r = Range(Range("A1"), Range("A1") _
.End(xlToRight).End(xlDown).Offset(-1, 0))
ActiveSheet.PageSetup.PrintArea = r.Address

this should not affect your headers and footers.

Regards
FSt1
"curiosity_killed_the_cat" wrote:

I have a spreadsheet that has a varying number of rows to print depending on
the amount of data. The columns are standard A:F but the rows could be 3 or
33. I have had a couple of goes but can't get it to play. Columns F have
data but don't print.

The cells after the last non blank have formulas that return "".

So, what I need is a code that will set the print area as A1:the last non
blank cell in Column F but not detect the formulas returning "" below the
last non blank.

Currently I have the print settings set to return [page]of[pages] as a
footer and A1:F1 at the top of each page. Am I correct in assuming that
specifying the print area won't alter those settings?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Another Print Area question

You don't need code.

You could use a Dynamic named range via InsertNameDefine

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),6)

This will give you the the printarea for columns A:F and ignores the "" returned
by your formulas.

Name it Print_Area


Gord Dibben MS Excel MVP

On Sat, 10 Nov 2007 22:50:00 -0800, curiosity_killed_the_cat
wrote:

I have a spreadsheet that has a varying number of rows to print depending on
the amount of data. The columns are standard A:F but the rows could be 3 or
33. I have had a couple of goes but can't get it to play. Columns F have
data but don't print.

The cells after the last non blank have formulas that return "".

So, what I need is a code that will set the print area as A1:the last non
blank cell in Column F but not detect the formulas returning "" below the
last non blank.

Currently I have the print settings set to return [page]of[pages] as a
footer and A1:F1 at the top of each page. Am I correct in assuming that
specifying the print area won't alter those settings?

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Another Print Area question

Is it possible to use this funciton to count all used rows including blank
rows?
I was able to modify the function in Excel 2000 to do this by using

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A)+COUNT IF(Sheet1!$A:$A,""),6)

In Excel 2000 this works fine as the COUNTIF function returns empty cells in
the used range.
However I also have some users working with Excel 2007 and the COUNTIF
function returns all empty cells in the range up to the maximum rows in the
sheet.

Any suggestions?

Thanks

"Gord Dibben" wrote:

You don't need code.

You could use a Dynamic named range via InsertNameDefine

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),6)

This will give you the the printarea for columns A:F and ignores the "" returned
by your formulas.

Name it Print_Area


Gord Dibben MS Excel MVP

On Sat, 10 Nov 2007 22:50:00 -0800, curiosity_killed_the_cat
wrote:

I have a spreadsheet that has a varying number of rows to print depending on
the amount of data. The columns are standard A:F but the rows could be 3 or
33. I have had a couple of goes but can't get it to play. Columns F have
data but don't print.

The cells after the last non blank have formulas that return "".

So, what I need is a code that will set the print area as A1:the last non
blank cell in Column F but not detect the formulas returning "" below the
last non blank.

Currently I have the print settings set to return [page]of[pages] as a
footer and A1:F1 at the top of each page. Am I correct in assuming that
specifying the print area won't alter those settings?

Thanks



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
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 12:50 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"