PC Review


Reply
Thread Tools Rate Thread

Address of cell invoking current UDF call?

 
 
Eddie
Guest
Posts: n/a
 
      23rd Apr 2008
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.


 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      23rd Apr 2008
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.


 
Reply With Quote
 
Mark Ivey
Guest
Posts: n/a
 
      23rd Apr 2008
Here is one option...

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


Mark Ivey

"Eddie" <(E-Mail Removed)> wrote in message
news:7E22E92F-193B-4FE7-A0ED-(E-Mail Removed)...
> 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.
>
>

 
Reply With Quote
 
Eddie
Guest
Posts: n/a
 
      23rd Apr 2008
Exactly what I need. And simple to boot. Thanks!!

"Jim Cone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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"?


 
Reply With Quote
 
Eddie
Guest
Posts: n/a
 
      23rd Apr 2008
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.

"Mark Ivey" <(E-Mail Removed)> wrote in message
news:486C3443-5EC6-4409-AEFD-(E-Mail Removed)...
> Here is one option...
>
> Sub GetCurrentAddress()
> Dim myCell As String
> myCell = ActiveCell.Address
> MsgBox myCell
> End Sub
>
>
> Mark Ivey
>
> "Eddie" <(E-Mail Removed)> wrote in message
> news:7E22E92F-193B-4FE7-A0ED-(E-Mail Removed)...
>> 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.
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum Column above current cell dynamically using function call TopSlice Microsoft Excel Worksheet Functions 7 15th Sep 2009 02:03 PM
Get Address of Current Cell dhstein Microsoft Excel Programming 7 22nd Nov 2008 05:58 PM
How do I call current computer time to a cell? Carol G. Microsoft Excel Worksheet Functions 9 14th Nov 2008 04:37 AM
Cell address of function call =?Utf-8?B?UGF0cmlja1M=?= Microsoft Excel Programming 1 25th Sep 2007 10:48 AM
Address of current cell Jalaluddin Microsoft Excel Worksheet Functions 1 6th Sep 2003 09:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:09 AM.