#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default where am I?

is there a function that identifies what cell a formula is being used in?

ex; I have a formula: =LMI(xx) entered into cell B32 as part of the code
behind the formula, I need to know what cell the formula is being used in.

many thanks in advance,
mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default where am I?

Here's a sample UDF using the Caller property:

' UDF which returns the address info of the cell
' in which it resides
Function Addr() As String
' Addr = Application.Caller.Address
' Or more detail
With Application.Caller
Addr = .Parent.Parent.Name & ", " & _
.Parent.Name & ", " & .Address(0, 0)
End With
End Function


--
Regards,
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility

"Mark Kubicki" wrote in message
...
is there a function that identifies what cell a formula is being used in?

ex; I have a formula: =LMI(xx) entered into cell B32 as part of the code
behind the formula, I need to know what cell the formula is being used in.

many thanks in advance,
mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default where am I?

Do you mean within the code for the LMI user defined function?

If yes, you can use application.caller

Option Explicit
Function LMI(xxx as yyyy) as uuuu
debug.print application.caller
...
end function

Mark Kubicki wrote:

is there a function that identifies what cell a formula is being used in?

ex; I have a formula: =LMI(xx) entered into cell B32 as part of the code
behind the formula, I need to know what cell the formula is being used in.

many thanks in advance,
mark


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default where am I?

I'm assuming LMI is a UDF that you wrote and it is its code that you want to
have know which cell called it. You would use Application.Caller to return a
range object which references that cell.

--
Rick (MVP - Excel)


"Mark Kubicki" wrote in message
...
is there a function that identifies what cell a formula is being used in?

ex; I have a formula: =LMI(xx) entered into cell B32 as part of the code
behind the formula, I need to know what cell the formula is being used in.

many thanks in advance,
mark


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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



All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"