VBA - USER DEFINED FUNCTIONS

PERSONALWESEN 

 
Function Alter(Geburtsdatum)
Alter = Year(Now() - Geburtsdatum) - 1900
End Function

Function Alter2(GDat As Date) As Integer
Alter2 = Int((Date - GDat) / 365.25)
End Function

Function Alter3(GDat As Date) As Integer
If Month(Date) = Month(GDat) Then
If Day(Date) = Day(GDat) Then

End If
End If
Alter3 = Int((Date - GDat) / 365.25)
End Function

Function Provision(Umsatz As Single) As Double
' ACHTUNG!! Reihenfolge-Problem bei der CASE-Anweisung
Select Case Umsatz
    Case Is >= 1000000
        Provision = Umsatz * 0.03
    Case Is >= 500000
        Provision = Umsatz * 0.02
    Case Else
        Provision = Umsatz * 0.01
End Select
End Function