On second thoughts, it sounds like you want to write a custom function -- the other replies came through while I was compiling the first one).
How exactly do you need to customise SUM? What features do you want, that it currently lacks? The reason I ask, is that SUM is fast. Any custom function that you create in VBA will be slower, so you need a compelling reason to change the inbuilt functions
Denis
Function sum2(r)
Dim c, d
For Each c In r
If IsNumeric(c) Then d = d + c
Next c
sum2 = d
End Function
Well, this is a basic sum function, but depending on what your future needs are, it may be better to write code for those needs.
Code:Function sum2(r) Dim c, d For Each c In r If IsNumeric(c) Then d = d + c Next c sum2 = d End Function
This isn't an exact duplication of the SUM function, if you want to supply numbers to this function rather than a range, pass them to the function as an array.