Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update matrix result in active cell vs. original (formula) cell #7

Open
Mathefreak007 opened this issue Dec 17, 2017 · 0 comments
Open

Comments

@Mathefreak007
Copy link

Actually the result matrix is created in the active sheet starting at active cell.
Usually it should be created starting the original cell containing the function call.

Example:

  • function fn(string s, int start, int end) gives back a column vector of numbers
  • We have two cases:
    s="M" --> result is the vector [start, start+1, start+2, ..., end]
    s="F" --> result is the vector [start+10, start+11, start+12, ..., end+10]

Assume we write the formula in cell A5 and we use cell A1 as reference for the first parameter s.

So:

  • A1 contains M
  • in A5 we write the formula: =fn(A1;1;100)
    That produces the vector [1,2,3,...,100] in cells A5,A6,A7,...,A105

Now we change the parameter in cell A1 from M to F.
That produces the vector [11,12,13,...,110] in cells A2,A3,A4,...,A102
So the second function call overwrites the function in cell A5.

(My) expectation:
result is updated in the original area, in the example in cells A5,A6,...

I think, the problem is using the active cell instead of the cell containing the function call which is actually performed.

public object display()
        {
            Excel.Application app = (Excel.Application)ExcelDnaUtil.Application;
            Excel.Worksheet worksheet = (Excel.Worksheet)app.ActiveWorkbook.ActiveSheet;
            Excel.Range startCell = app.ActiveCell;

            var propKey = "" + startCell.Row + PROPERTY_DIVIDER + startCell.Column;

Hope my explanation is clear enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant