Thread: Sum
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Sum

two ways

Option Explicit
Sub sum_column_H()
Dim lastrow As Long
Dim ws As Worksheet

Set ws = Worksheets("sheet1")
lastrow = Cells(Rows.Count, "H").End(xlUp).Row
ws.Range("H" & lastrow).Offset(1).Formula = "=sum(h5:h" & lastrow & ")"
End Sub

or if you want just the value use the line below instead
ws.Range("H" & lastrow).Offset(1).Value = Application.Sum(Range("h5:H" & _
lastrow))

--


Gary


"Mike" wrote in message
...
I have a workbork that does a mdb query by Date Range. Different Date ranges
returns more or less data. I would like to have Column H to total up at end
of data. My Start of data is H5. Can someone give me some insight on how to
do this

Thanks Mike