Functions with multiple inputs?

N

Nicolas

I couldn't make a function with a matrix as input. My idea is to write a
macro (a function in VBA for Excel) witch reeds a matrix (of variable size)
and develops a number. The problem is that I can't find the way to write the
function with multiple inputs (like the function SUM(A1:A5) )

Does anyone knows how to do that?

Nicholas
 
N

Niek Otten

Hi Nicholas,

Function Testa(RangeA as Range) as Double

What do you want the function to do?
Maybe this example function is af help to you

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

==========================================================
Function VLookupSort(SearchArgument As Range, SearchTable As Range, _
ColumnNo As Long, Optional SortDirection, Optional NotFound)
' Works as Vlookup, exact match (4th argument = FALSE)
' But takes advantage of the fact that a table is sorted
' and thus is much faster
' Also permits table to be sorted descending (Sortdirection -1)
' Optional argument for return value if item not found, defaults to #NA
Dim ItemFound

If IsMissing(SortDirection) Then SortDirection = 1

ItemFound = Application.Match(SearchArgument, Intersect(SearchTable, SearchTable.Cells(1).EntireColumn), _
SortDirection)
If SearchTable(ItemFound, 1) <> SearchArgument Then
If IsMissing(NotFound) Then
VLookupSort = CVErr(xlErrNA)
Else
VLookupSort = NotFound
End If
Else
VLookupSort = _
SearchTable(ItemFound, ColumnNo)
End If
End Function
==========================================================

|I couldn't make a function with a matrix as input. My idea is to write a
| macro (a function in VBA for Excel) witch reeds a matrix (of variable size)
| and develops a number. The problem is that I can't find the way to write the
| function with multiple inputs (like the function SUM(A1:A5) )
|
| Does anyone knows how to do that?
|
| Nicholas
|
 
J

jeff.j.griffith

You could just have one input variable - try using a Collection and the
calling method can populate it with whatever you need in it. You can
then process through it using For...Next logic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top