Hi,
I would like to find a way to retrieve the cell location of a function when it is executed.
To illustrate what I am trying to do, please look at this example.
We assume that we have two functions:
[ExcelFunction(Description = "Add", Category = "")]
public static int Add(int number1, int number2)
{
return number1 + number2;
}
[ExcelFunction(Description = "Sub", Category = "")]
public static int Sub(int number1, int number2)
{
return number1  number2;
}
In my excel spreadsheet, I have the following:
Cell A1: =Add(B1,C1)
Cell A2: =Sub(B1,C1)
When I change the value of the cell B1 or C1, both "Add" and "Sub" function are executed.
When the "Add" is executed, I would like to find a way to know that the location of the executed function is "A1".
When the "Sub" is executed, I would like to find a way to know that the location of the executed function is "A2".
My final objective is the following : my real function will return an array of values and I want to write these values into multiple cells, one row after the row where the function is.
I found a way to write the values outside the cell of the executed function by using the "AfterCalculate" event. But I didn't find a way to retrieve the position of the executed function to write the result automatically one row after.
Thank you for your help!
Fabien
