UDF help

  • Thread starter Thread starter Salman
  • Start date Start date
S

Salman

I need to use the address of a cell where I enter a UDF in
the UDF itself. How can I do that?

So the UDF code would say something like:

take column number of cell where function is entered
return the number of columns between function and column D

Thanks.
 
Salman,

Application.Caller will return a Range reference to the cell
which called the function.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Hi Salman,

A user defined function does not know the address where you
enter the function, you would have to include that as a parameter.

You can use a function in another macro that has absolution no
connection with any cell address.
i.e. convert_to_cubic_yards(500)

Can you use a worksheet function

H44: =COLUMN(H44) - COLUMN(D1)
 
in a UDF

Dim rng as Range
set rng = Applition.Caller

will set rng to the cell containing the UDF
 
application.caller it is, now I've got to do 5 good replies to
make up for my mistake.

David
 

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

Back
Top