AutoSum Syntax

  • Thread starter Thread starter MikeTunny
  • Start date Start date
M

MikeTunny

I have created a Macro which loops down a single colum to find the nex
empty cell, I then used the following syntax to select all the dat
that I have looped through;

ActiveCell.Offset(-1, 0).Select

Range (Selection, Selection.End(xlUp)).Select

I now need to auto Sum that data so it apears in my empty Cell at th
bottom. Is there code I can use to produce an automatic AutoSum??? O
is there another solution? Can I use R1C1 style to paste in a formul
that has variable colum sizes?

Please help

Mike Tunstal
 
with the first cell at the top of the column to sum as the active cell

Sub AABBD()
Dim rng As Range
Set rng = Range(ActiveCell, ActiveCell.End(xlDown))

rng.Offset(rng.Rows.Count, 0).Resize(1, 1).Formula = _
"=Sum(" & rng.Address(0, 0) & ")"

End Sub
 
Back
Top