Problem with function

B

Bob

Hi Everyone:

I have written a simple function that I plan to call from my spreadsheet.
However, it does not work. Does anyone know why?

Public Type ComplexNumber
Re As Double
Im As Double
End Type

Public Function CComplex(x As Double, y As Double) As ComplexNumber
CComplex.Re = x
CComplex.Im = y
End Function

Public Function Cdisplay(x As ComplexNumber)
Cdisplay = x.Re & "+" & x.Im & "i"
End Function

When I call this function in a cell, for example in cell B3 I type
"=cdisplay(ccomplex(2,3))", I get #VALUE!

Thanks for all your help.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top