View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
aussiegirlone aussiegirlone is offline
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of data
that would have the word €śTotal€ť displayed in the column AC and then
calculate the total Sum in column AF. Is this possible