I have a function similar to this
Public Function func(ByRef mandatory_arg1 As Range, ByRef mandatory_arg2 As Range, _
Optional ByRef optional_Arg1 As Range, Optional ByRef optional_arg2 As Range, _
Optional ByRef optional_arg3 As Range, Optional ByRef optional_arg4 As Range, _
Optional ByRef optional_arg5 As Range, Optional ByRef optional_arg6 As Range) As Double
func = WorksheetFunction.SumIfs(mandatory_arg1, ...) / WorksheetFunction.SumIfs(mandatory_arg2, ...)
End Function
What is the best way to handle the cases where arguments are missing? Is using an If-Else structure similar to
if IsMissing(optional_Arg1) or IsMissing(optional_Arg2) Then
' ...
EndIf
the only way? Or will WorksheetFunction.SumIfs(...)
ignore arguments of Nothing
?