 Public Function Test(rng As Range) As Double

Set oRng = Application.ActiveSheet.Range("A1", "A3")

oRng.Formula = "=C3+C5"

Test = 0

End Function
I don't know if the problem is that it's not possible to modify the "Formula" property of a cell from a custom formula.
Is there any solution?
Thanks for your help!
Not sure exactly what the problem is here, but there are a couple of things which stand out...
 Where is oRng defined? How does it relate to the parameter rng that was passed to the function?
 Have you tried commenting out lines of code (starting with all of them commented) to work out exactly where it's hanging?
 I'm not that familiar with Excel's VBA, so bear with me  is it possible to set .Formula for a range like this, as opposed to an individual cell?
 Is it possible you have set up some sort of circular reference? For example, is there a formula in cell C3 or C5 which refers to the Test() function? In that case, your function might be causing a calculation which calls your function, which causes a calculation which calls your function, which causes a calculation which calls your function, which causes a calculation which calls your function, ... I think you get the idea  see why that would get hung up?