Sender cell and UDF.

Add-in Express™ Support Service
That's what is more important than anything else

Sender cell and UDF.
Thomas Horstmann

Posts: 11
Joined: 2020-08-24
I have got an Excel UDF. Is there a way to locate the cell which sends/calls the function, when I calculate it?
Posted 08 Sep, 2020 06:41:24 Top
Dmitry Kostochko

Add-in Express team

Posts: 2865
Joined: 2004-04-05
Hi Thomas,

The Excel Object Model has the Caller property:

Please see below a small code sample below:

function TADX_XLFunction.MyFunc(const param0, param1, param2: OleVariant): OleVariant;
  caller: OleVariant;
  rng: ExcelRange;
  addr: WideString;
  caller := Self.COMAddInModule.ExcelApp.Caller[EmptyParam, adxLCID];
  if Not VarIsError(caller) then begin
    if (TVarData(caller).VType = varDispatch) then begin
      rng := IDispatch(TVarData(caller).VDispatch) as ExcelRange;
      addr := '+++ ' + rng.Address[true, true, xlA1, false, false];


Posted 08 Sep, 2020 10:53:06 Top