Sum in a dynamic range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I need to produce code to add a formula in a cell at the bottom of a column
full of data which sums the values in that column. However the number of rows
in the column may vary. I can see the a formula R1C1 is needed to take the
Sum function but this requires R1C1 references. How can I change this to
accept the dynamic range.
 
Alan -

Sub d()
With Sheet1.Range("c1")
.End(xlDown).Offset(1).Formula = "=sum(" & .Address & ":" &
..End(xlDown).Address & ")"
End With
End Sub
 
Back
Top