Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Address of cell invoking current UDF call?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eddie - 23 Apr 2008 02:40 GMT
I would like to write a user defined function that, as part of its
execution, needs to know the cell address from which it is currently called.
I.e. if
   cell A1
       = UDF(parm1, parm2)
then,
   what type of statement can I use in the UDF to return the executing cell
address "A1"?

Assuming, of course, that such a thing is possible.  Thanks in advance.
Larry.
Jim Cone - 23 Apr 2008 03:23 GMT
Try out this udf...
'--
 Function Sludge()
   Sludge = Application.Caller.Address
 End Function
'--
Jim Cone
Portland, Oregon  USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"Eddie"
wrote in message
I would like to write a user defined function that, as part of its
execution, needs to know the cell address from which it is currently called.
I.e. if
   cell A1
       = UDF(parm1, parm2)
then,
   what type of statement can I use in the UDF to return the executing cell
address "A1"?

Assuming, of course, that such a thing is possible.  Thanks in advance.
Larry.
Eddie - 23 Apr 2008 04:08 GMT
Exactly what I need.  And simple to boot.  Thanks!!

> Try out this udf...
> '--
[quoted text clipped - 19 lines]
> cell
> address "A1"?
Mark Ivey - 23 Apr 2008 03:25 GMT
Here is one option...

Sub GetCurrentAddress()
Dim myCell As String
myCell = ActiveCell.Address
MsgBox myCell
End Sub

Mark Ivey

> I would like to write a user defined function that, as part of its
> execution, needs to know the cell address from which it is currently
[quoted text clipped - 7 lines]
> Assuming, of course, that such a thing is possible.  Thanks in advance.
> Larry.
Eddie - 23 Apr 2008 04:12 GMT
Thanks, Mark.  This works for the active cell, but a cell calling a user
defined function may not necessarily be the active cell -- which Jim's
solution gets at.  But I still appreciate the help.

Gotta love these help groups.  Seldom fail to find people willing to help
out.

> Here is one option...
>
[quoted text clipped - 17 lines]
>> Assuming, of course, that such a thing is possible.  Thanks in advance.
>> Larry.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.