User defined functions aware of what cell they are placed in?

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

I would like to make a user defined function which needs to know in
what cell and what worksheet it is placed in. I will be using this UDF
in multiple cells on multiple worksheets. I originally just passed the
cell row and column as parameters to the UDF however this ended up
updating all worksheets and not just the one the UDF was on.

Is there any way to do this?
 
Option Explicit
function myfunct(something as somethingelse) as something

msgbox application.caller.address & vblf _
& application.caller.parent.name & vblf _
& application.caller.parent.parent.name

End function

(application.caller is what you're looking for)
 
Thanks!

Exactly what I've been looking for

Option Explicit
function myfunct(something as somethingelse) as something

msgbox application.caller.address & vblf _
& application.caller.parent.name & vblf _
& application.caller.parent.parent.name

End function

(application.caller is what you're looking for)
 
Back
Top