Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default intersection with linear range as true argument

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default intersection with linear range as true argument

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
intersection of a range Janis Excel Discussion (Misc queries) 1 July 19th 07 07:04 PM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
Range as argument in function Asif[_3_] Excel Programming 3 December 6th 03 01:38 PM
Passing range as argument Jan Kronsell[_2_] Excel Programming 3 September 3rd 03 12:31 PM
how to? set my range= my UDF argument (range vs. value in range) [advanced?] Keith R[_3_] Excel Programming 2 August 11th 03 05:55 PM


All times are GMT +1. The time now is 03:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"