Total row in report

  • Thread starter Thread starter Moo
  • Start date Start date
M

Moo

I have a spreadsheet that I would like to total at the bottom. But I don't
want to have to keep inserting rows when it fills up. Is there a way to have
the total at the very bottom of the spreadsheet, but still have it print out
on a report with all the data?
 
Hi
The usual way around this is to have a Totals line at the top of the list,
under the titles, and then use Window/Freeze Panes so you can see it all of
the time.
 
Another way is to use a second sheet to do your calculations. This would
probably require you to write a little VBA code to find the last row of
data.

It's too bad Excel does not have knowledge of keywords like END or LAST.
This would make life much easier if you could do something like:
=SUM(A1:LAST)

Glenn
 
U¿ytkownik "Glenn Mulno said:
Another way is to use a second sheet to do your calculations. This would
probably require you to write a little VBA code to find the last row of
data.

It's too bad Excel does not have knowledge of keywords like END or LAST.
This would make life much easier if you could do something like:
=SUM(A1:LAST)

Glenn

you can try to modify this code to your requirements:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ttlrows = Range("a1").CurrentRegion.Rows.Count
Range("a1").End(xlDown).Offset(1, 0) =
WorksheetFunction.Sum(Range("a1:a" & ttlrows))
End Sub

paste it into workseet module
i assumed that data you want to sum up are located in col A
each time you print it will add sum of col A in last row ( assuming that no
row is blank i col A)

mcg
 
Macgru said:
you can try to modify this code to your requirements:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ttlrows = Range("a1").CurrentRegion.Rows.Count
Range("a1").End(xlDown).Offset(1, 0) =
WorksheetFunction.Sum(Range("a1:a" & ttlrows))
End Sub

paste it into workseet module
i assumed that data you want to sum up are located in col A
each time you print it will add sum of col A in last row ( assuming that
no
row is blank i col A)

mcg

Where do I paste it in the worksheet module?
 
Back
Top