Can somebody please tell me what is wrong with the program written below!!! it gives a Name error when i call his function Acost.

De, Ds, Da and Dt are dates and Sc and Sb are numbers.

Please help
thanking in advance.
Regards,
No27fiorano


Function Acost(Dt As Date, Ds As Date, Sc As Double, Optional Sb As Variant, Optional De As Variant, Optional Da As Variant) As Double


If IsMissing(De) Then
Acost = ((((Da - Ds) / 30) * Sb) + (((Dt - Da) / 30) * Sc))
Else
If De <= Da Then
Acost = ((De - Ds) / 30) * Sb
Else
Acost = ((((Da - Ds) / 30) * Sb) + (((De - Da) / 30) * Sc))
End If
End If

End Function