Gepostet am: May 22, 2012 1:56:46 PM
Jahre der Abschreibung
Public Function AbschreibungJahre(StartDatum As Date, EndDatum As Date) As DoubleDim Jahre As Double'Sonnderfall 1.1.XXIf Month(EndDatum) = 1 And Day(EndDatum) = 1 Then EndDatum = DateSerial(Year(EndDatum) - 1, 12, 31)End If'Ermitteln, ob im ersten Jahr Ganzjahresabschreibung oder HalbjahresabschreibungIf Year(StartDatum) = Year(EndDatum) Then If Month(StartDatum) <= 6 And Month(EndDatum) <= 6 Then Jahre = 0.5 ElseIf Month(StartDatum) >= 7 And Month(EndDatum) >= 7 Then Jahre = 0.5 Else Jahre = 1 End IfElse If Month(StartDatum) <= 6 Then Jahre = 1 Else Jahre = 0.5 End IfEnd If'Ermitteln, ob im letzten Jahr Ganzjahresabschreibung oder HalbjahresabschreibungIf Year(StartDatum) <> Year(EndDatum) Then If Month(EndDatum) <= 6 Then Jahre = Jahre + 0.5 Else Jahre = Jahre + 1 End IfEnd If'Jahre dazwischenIf Year(StartDatum) <> Year(EndDatum) Then Jahre = Jahre + Year(EndDatum) - Year(StartDatum) - 1End If'Rückgabe Jahre AbschreibungJahre = Jahre End Function