counting the values in a column of cells

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.
 
D

Don Guillett

Sub countformulas()
mysum = 0
For Each c In Selection
If c.HasFormula Then mysum = mysum + 1
Next
MsgBox mysum
End Sub
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top