The error message I'm getting is that the arguments aren't optional. The weird thing is that in excel im filling al the arguments (with cells in the form of
"Termijnberekening(C4;D4;F4)"
But it still gives me the error. Below my code:
Expand|Select|Wrap|Line Numbers
- Function Termijnberekening(Termijn As Variant, Ingangsdatum As Date, Einddatum As Date) As Integer
- If Termijn = "Maand" Then
- Termijnberekening = (Year(Einddatum) - Year(Ingangsdatum)) * 12 + Month(Einddatum) - Month(Ingangsdatum)
- ElseIf Termijn = "Kwartaal" Then
- Termijnberekening = (Year(Einddatum) - Year(Ingangsdatum)) * 4 + WorksheetFunction.RoundUp((Month(Einddatum) - Month(Ingangsdatum)) / 3)
- ElseIf Termijn = "Jaar" Then
- Termijnberekening = (Year(Einddatum) - Year(Ingangsdatum))
- Else
- Termijnberekening = "Kies Termijn Type"
- End Function