Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get reference to cell containing function

Tags:

excel-dna

Is there is way to access cell that contains my UDF? I need to reset some cache when function with same parameters is run from different cell. Didn't find anything suitable in exceldna utils.

Thanks, Alex

like image 428
Alex Michel Avatar asked Sep 06 '25 19:09

Alex Michel


1 Answers

You can call

ExcelReference caller = XlCall.Excel(XlCall.xlfCaller) as ExcelReference;

The result will be an ExcelReference if you're called from a sheet formula. It might be null if you're called via Application.Run or a few other ways.

ExcelReference is a wrapper for the C API sheet reference.

like image 87
Govert Avatar answered Sep 10 '25 13:09

Govert