counting the values in a column of cells

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

To anyone who can help!

I am trying to count up the values in a column of cells
that contain formulas so i can give a sub total at the
bottom of the sheet. I am trying to do this using vb.

Does anyone have the code to do this?

thanks, bob from long island, n.y.
 
Sub countformulas()
mysum = 0
For Each c In Selection
If c.HasFormula Then mysum = mysum + 1
Next
MsgBox mysum
End Sub
 
Sub BuildSum()
set rng = Cells(rows.count, Activecell.Column).End(xlup)(2)
rng.formulaR1C1 = "=Sum(R1C:R[-1]C)"
' if you don't want the formula
rng.Formula = rng.Value
End Sub
 
Back
Top