Count a range : Count « Excel « VBA / Excel / Access / Word






Count a range

 

Sub addAmtRel()
    Set myRange = Range(ActiveCell, ActiveCell.End(xlUp))   '   Substitute your range here
    myCount = Application.Count(myRange)
    ActiveCell.Formula = "=SUM(R[" & -myCount & "]C:R[-1]C)"  '   Substitute your cell address here
End Sub

 








Related examples in the same category