Re: Nichtausführung von Functionen
18.11.2002 16:04:55
matthias
Hallo Hajo,es betrifft keine spezielle Function, sondern tritt bei allen auf.
Dennoch ein Bespiel:
Function MaxDrawdown_Prozent(Bereich As Range, Abstand%)
'Berrechnung von einem Hochpunkt in einem Bereich bis zum Wiedererreichen und Ermittlung des Verlustes dazwischen
Application.ScreenUpdating = False
On Error Resume Next
Dim StepBereich As Range
Dim Maxwert#, minwert#, von%, startpunkt%, bis%, maxddneu#
gesamtvon = Bereich.Row
gesamtbis = Bereich.Count + gesamtvon
spaltewerte = Bereich.Column
startpunkt = gesamtvon
MaxDrawdown_% = 0
For x = 1 To gesamtbis / Abstand
Set StepBereich = Range(Cells(startpunkt, spaltewerte), Cells(startpunkt + Abstand, spaltewerte))
Maxwert = Application.WorksheetFunction.Max(StepBereich)
For von = startpunkt To startpunkt + Abstand
If Cells(von, spaltewerte) = Maxwert Then
Exit For
End If
Next
For bis = von + 1 To gesamtbis
If Cells(bis, spaltewerte) >= Maxwert Then
Exit For
End If
Next bis
minwert = Application.WorksheetFunction.Min(Range(Cells(von, spaltewerte), Cells(bis, spaltewerte)))
maxddneu = minwert / Maxwert - 1
If maxddneu < MaxDrawdown_Prozent Then
MaxDrawdown_Prozent = maxddneu
End If
startpunkt = bis
'Debug.Print MaxDrawdown_Prozent, minwert, Maxwert
Next x
End Function
Mir kommt es so vor, daß die Berechnung insbesondere nach dem Speichern falsch ist.
Matthias