Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Sum the range

Sub addAmtAbs()     Set myRange = Range(ActiveCell, ActiveCell.End(xlUp))   '   Substitute your range here     Dim myCount As Integer     myCount = Application.Count(myRange)     ActiveCell.Formula = "=SUM(B1:B" & myCount & ")"  '   Substitute your cell address here End Sub