"Sum" function as Macro

  • Thread starter Thread starter orenfarhi
  • Start date Start date
O

orenfarhi

I've finally got it :

Code
-------------------
Sub sumf()
'simulation of sum function
S = 0
x = ActiveCell.Row()
x = x - 1
For i = x To 6 Step -1
If Cells(x, 6) <> 0 Then
S = S + Cells(x, 6).Value
Else
S = S
End If
Next i
[sumall] = S
ActiveCell.FormulaR1C1 = "=SUM(sumall)"
End Sub

-------------------


but, if i change a value it doesn't change the sum automatically.
would have to run the code once again.
Any ideas???
thanks
 
put it in the sheet(s) where you want it to operate and have it as
worksheet selectionchange sub if need be define the range you want i
to work on.

HTH

Simo
 

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

Back
Top