So ich hab jetzt mal versucht den Code aufzustellen. Leider klappt es noch nicht ganz. Vielleicht sieht jemand den Fehler.
Vielen Dank fuer eure Hilfe!
Viele Gruesse
Nici
...........................
Option
Explicit
Function
Profit(
ByVal
Ini_Money
As
Long
,
ByVal
Max_Plays
As
Long
, Stop_Profit
As
Long
)
As
Long
Dim
i
As
Long
, b
As
Long
, p
As
Long
, tp
As
Long
, r
As
Double
, rd
As
Long
i = 1
b = 1
tp = 0
Do
While
Ini_Money >= i
And
b <= Max_Plays
And
tp <= Stop_Profit
r = Rnd()
If
r >= 0.513513513513513
Then
rd = 1
Else
rd = 0
End
If
p = 2 * i * rd
If
rd = 0
Then
Ini_Money = Ini_Money - i
i = i * 2
Else
Ini_Money = Ini_Money + p
i = 1
End
If
If
i > Ini_Money
Then
WorksheetFunction.Sum (i) - Ini_Money
End
If
b = b + 1
tp = tp + p
Loop
Profit = tp
End
Function