Thread: Bland Rows
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Bland Rows

I have tried to keep whatever is doing it NOT put in the additional dot.
..Rows("1:" & mr).Address
should be
.Rows("1:" & mr).Address

Don Guillett
SalesAid Software

"tankerman" wrote in message
...
I got a syntax error on this line of the code ..PageSetup.PrintArea =
.Rows("1:" & mr).Address

"Don Guillett" wrote:

Right click excel icon in upper left next to fileview codeinsert
thissavetest

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
lr = .Cells(.Rows.Count, "a").End(xlUp).Row
For r = lr To 1 Step -1
If Application.CountA(.Rows(r)) 1 Then mr = .Rows(r).Row: Exit For
Next r
..PageSetup.PrintArea = .Rows("1:" & mr).Address
'or to limit columns
'.PageSetup.PrintArea = .Range("a2:x" & mr).Address
End With
End Sub

--
Don Guillett
SalesAid Software

"tankerman" wrote in message
...
My spreadsheet has 250 rows and A thru AG in columns, all cells are
bordered.
All of the columns are used if a row is used. My sheet has 15% more
rows
than our highest use this year so that I am sure our office does not
run
short of rows (my workbook has 12 of these sheets because we track the
info
monthly and forward the sheets as filled out to other personel).

My question is how do I print the sheets (only one month is printed at
a
time) to print only the rows that has been filled out, all of the sheet
rows
are continuous, we have no unused rows except for the ones left at the
bottom
that are unused. when ever I print the sheets it always prints a few
extra
pages from the bottom that are just the gridding. I don't want to have
to
delete all of the unused row before I print the sheet.