Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Most (maybe all) of Excel's built-in functions can take a linear (1x? or ?x1) range as an argument that is ultimately meant to be only a single cell. The built-in functions interpret/pass the argument as the cell with the same row or column as the cell from which the function is called depending on weather the argument range is vertical or horizontal. I would liike to have this same functionality with my own custom functions. Is there some special means of doing this or is it necessary to have a sub that is called internally by all my functions that uses indices, etc. to convert a range argument to the proper single cell? Does anyone have such a sub already written that they are willing to share? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have to program the functionality yourself.
Jim Rech once suggested: ========================== I don't know if you can tell Excel what to pass you but you can build a bit more flexibility into your function as below. I wouldn't want to have to do this routinely but fwiw. Function X(Rg As Range) As Variant If Rg.Columns.Count 1 Then Set Rg = Intersect(Application.Caller.E*ntireColumn, Rg) ElseIf Rg.Rows.Count 1 Then Set Rg = Intersect(Application.Caller.E*ntireRow, Rg) End If X = Rg.Value End Function -- Jim Rech Excel MVP -- Regards, Tom Ogilvy "TACTG" wrote in message ... Hello, Most (maybe all) of Excel's built-in functions can take a linear (1x? or ?x1) range as an argument that is ultimately meant to be only a single cell. The built-in functions interpret/pass the argument as the cell with the same row or column as the cell from which the function is called depending on weather the argument range is vertical or horizontal. I would liike to have this same functionality with my own custom functions. Is there some special means of doing this or is it necessary to have a sub that is called internally by all my functions that uses indices, etc. to convert a range argument to the proper single cell? Does anyone have such a sub already written that they are willing to share? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
intersection of a range | Excel Discussion (Misc queries) | |||
Function (array argument, range argument, string argument) vba | Excel Programming | |||
Range as argument in function | Excel Programming | |||
Passing range as argument | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |