开发者

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.


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.


Not very elegant, but try this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜