"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 |
"Sum" function as Macro
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 -- Simon Lloy ----------------------------------------------------------------------- Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670 View this thread: http://www.excelforum.com/showthread.php?threadid=27633 |
All times are GMT +1. The time now is 07:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com