View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_357_] mudraker[_357_] is offline
external usenet poster
 
Posts: 1
Default Sum at end of data?


Here are 2 ways

the first finds the last used row in column A then places the sum
formula in the next row

The 2nd finds the last used row in any column then places the sum
formula in the next row in column A

Sub SumColumn()
Dim lRow As Long
lRow = Cells(Rows.Count, "a").End(xlUp).Row
Cells(lRow + 1, "a").Value = "=sum(a3:a" & lRow & ")"
End Sub


Sub SumColumn()
Dim lRow As Long
lRow = Cells.Find(What:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

Cells(lRow + 1, "a").Value = "=sum(a3:a" & lRow & ")"
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=532153