Hi again
I have entered the following function:
Public Function ranpoi(mean)
Dim Value As Double
Dim Prod As Double
Value = Exp(-mean)
Prod = 1
Do Until (Prod < Value)
ranpoi = ranpoi + 1
Prod = Prod * Rnd()
Loop
ranpoi = ranpoi - 1
End Function
And now I want to simulate x values from the possion distribution. So I've entered this code:
Sub PoiSimu2()
Dim lambda As Double
lambda = Range("C2").Value
With Range("T1:T1000")
.Formula = "=randoi(Lamdda)"
.Value = .Value
End With
End Sub
But all cells returns #NAME? - why?
Hope that some of you can help me - maybe tell me, in short, what I'm missing about the syntax?
Bookmarks