View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Giggly4g Giggly4g is offline
external usenet poster
 
Posts: 21
Default Find last cell in column then SUM in cell directly below

Looks like I'm almost there. Let's say one of the columns I want to sum is G.
So I modified the code to read like so (VBA didn't like the underscore that
you included so I deleted it)...

..Offset(2, 0).Formula = "=Sum($G$1:" &
.Address & ")"

What I end up with is "Sum($G$1$A$86)" appearing two cells down from the end
of column A. Two questions...1) how can I get the sum to show at the end of
column G and 2) what is wrong with the formula that it shows up this way?

"Mike" wrote:


Sub sumColumA()
With Worksheets("Sheet1")
If IsEmpty(.Cells(.Rows.Count, 1)) Then
With .Cells(.Rows.Count, 1).End(xlUp)
.Offset(2, 0).Formula = "=Sum($A$1:" & _
.Address & ")"
End With
End If
End With
End Sub
"Giggly4g" wrote:

Hi! I need to locate the last cell with data in a column then go to the cell
directly beneath it and add in the sum function. The GoTo blank function
doesn't work because some of the cells within rows are blank. The number of
rows varies from day-to-day. I need to do this for several columns of the
worksheet. Your assistance is greatly appreciated.