View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
orenfarhi orenfarhi is offline
external usenet poster
 
Posts: 1
Default "Sum" function as Macro


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

--
orenfarh
-----------------------------------------------------------------------
orenfarhi's Profile: http://www.excelforum.com/member.php...fo&userid=1622
View this thread: http://www.excelforum.com/showthread.php?threadid=27633