excel - Function with multiple parameters -


i have vba function multiple arguments, need excel sheet , not sub, how divide inputs number of parameters need function?

ex:

function func(a double,b double) double     'calculations     'some return value end function 

this how have been trying values:

this how have been trying values

if want handle multiple arguments of don't know number of, use paramarray argument

for instance, assuming func() should sum arguments pass it:

function func(paramarray args() variant) double     dim long     dim cell range      = lbound(args) ubound(args) '<--| loop through each passed argument         if typename(args(i)) = "range" '<--| if current element range             each cell in args(i) '<--| loop through range cells                 func = func + cell.value             next cell         else '<--| otherwise             func = func + args(i) '<--| process current argument value         end if     next end function 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -