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
 
Top