Fehlerhafte Ausgabe von Wert
29.11.2004 08:28:02
Wert
Hier der Code:
Function DIENSTALTER(Eintrittsdatum As Date)
'Varibeln
Dim Heute As Date
'Heutedatum in Speicher nehmen
Heute = WorksheetFunction.Date()
'Verweis zu korrekter Kalkulation
If WorksheetFunction.Month(Heute) < WorksheetFunction.Month(Eintrittsdatum) Then GoTo Kalk1 Else GoTo wenn1
wenn1: If WorksheetFunction.Month(Heute) > WorksheetFunction.Month(Eintrittsdatum) Then GoTo Kalk2 Else GoTo wenn2
wenn2: If WorksheetFunction.Day(Heute) < WorksheetFunction.Day(Eintrittsdatum) Then GoTo Kalk1 Else GoTo Kalk2
'Berechnung und Ausgabe des Dienstalters
Kalk1: DIENSTALTER = WorksheetFunction.Year(Heute) - WorksheetFunction.Year(Eintrittsdatum) - 1
Kalk2: DIENSTALTER = WorksheetFunction.Year(Heute) - WorksheetFunction.Year(Eintrittsdatum)
End Function