Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

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