Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 ================================================== ======== "Nicolas" wrote in message ... |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 | |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Finally I could write the macro as a Function.
I don't have to use the Sub anymore. Thank you very much. En del 2/12/06 15:27, "Niek Otten" escribió: 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. Nicolas wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple inputs on a spreadsheet | Excel Discussion (Misc queries) | |||
Multiple inputs one output | Excel Discussion (Misc queries) | |||
Define inputs and outputs to make functions from sheets | Excel Discussion (Misc queries) | |||
how do i have multiple inputs and 1 output | Excel Programming | |||
Using Range inputs in functions | Excel Programming |