Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why am I not able to invoke this function? all I get is the same old
"#VALUE!" when I'm calling it in the excel cell as =addnumbers(10) it is working fine and returning me a '10' onto the cell. But when I say =addnumbers(10,20) or =addnumbers(10,20,30), it gives me a "#VALUE!" public double AddNumbers(double Number1, [Optional] object Number2, [Optional] object Number3) { double result = 0; result += Convert.ToDouble(Number1); if (!(Number2 is System.Reflection.Missing)) { Excel.Range r2 = Number2 as Excel.Range; double d2 = Convert.ToDouble(r2.Value2); result += d2; } if (!(Number3 is System.Reflection.Missing)) { Excel.Range r3 = Number3 as Excel.Range; double d3 = Convert.ToDouble(r3.Value2); result += d3; } return result; } What could be the problem!? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Code Not Working | Excel Discussion (Misc queries) | |||
code not working | Excel Programming | |||
VB Code Is Not Working | Excel Discussion (Misc queries) | |||
Code is not working....please take a look!!! | Excel Programming | |||
For Each Code Not Working | Excel Programming |