ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XLL Formula Reference (https://www.excelbanter.com/excel-programming/277481-re-xll-formula-reference.html)

Rob Bovey

XLL Formula Reference
 
"Matthew Wieder" wrote in message
...
We inherited an xll which provides a formula that can be used in a cell
in Excel. If someone uses that formula on a spredahseet (let's say in
cell F4) and then they recalc, is there some way for us in that xll code
to know that the formula is in cell F4?
thanks!


Hi Matthew,

Here's one way to determine the address of a function's calling cell:

XLOPER xlRef, xlRow, xlCol, xlAddress;
Excel4(xlfCaller, &xlRef, 0);
xlRow.xltype = xltypeNum;
xlRow.val.num = xlRef.val.sref.ref.rwFirst + 1;
xlCol.xltype = xltypeNum;
xlCol.val.num = xlRef.val.sref.ref.colFirst + 1;
Excel4(xlfAddress, &xlAddress, 2, &xlRow, &xlCol);
// xlAddress now contains the calling cell's address

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *




All times are GMT +1. The time now is 07:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com