Nacho
Nacho

Reputation: 87

C# and Excel automation Add-in problems

I'm kind of new to c# and trying to create an automation add-in for excel and I followed the instructions given in this article

This is working fine when I use numbers as parameters to the function called from a cell

 =MultiplyNTimes(3,7,8)

but when I use cell addresses

=MultiplyNTimes(A1,B2,C3)

excel doesn't recognize the function and it throws the #NAME error.

Debugging in VS, I can see that the function is not even called.

Upvotes: 0

Views: 434

Answers (2)

tim
tim

Reputation: 29

Just guessing, but the first thing I would try is to to change the function parameters for

public double MultiplyNTimes(double number1, double number2, double timesToMultiply)

to

public double MultiplyNTimes(Excel.Range number1, Excel.Range number2, Excel.Range timesToMultiply)

..to get it to accept worksheet cell addresses instead of numeric values.

Upvotes: 1

user645280
user645280

Reputation:

Not very elegant, but try this:

=MultiplyNTimes(VALUE(A1),VALUE(B2),VALUE(C3))

Upvotes: 0

Related Questions