getting the column address of an argument to a user defined functi

G

Guest

Hi I want to write a UDF in which I will need to access the column numbers of
function arguments from inside the body of the function. Example code is:

Function UserDefined(leftarg as double, rightarg as double) as double
n=worksheet columnnumber of leftarg
etc.
End function

Is there an easy way to access the column or worksheet address of a
function's arguments?

Thanks.
 
G

Guest

Function UserDefined(leftarg as range, rightarg as range) as double
n=leftarg.column
etc.
End function
 
N

NickHK

You can't get the address of a "leftarg" because it declared as a Double and
as such does not have an address.
If you pass the range, then you can. e.g.
Function UserDefined(leftarg as Range, rightarg as Range) as double
Dim ColNum As Long
Dim WS As Worksheet

ColNum=leftarg.column
Set WS=leftarg.Parent
....etc

NickHK
 

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