PDA

View Full Version : Complex numbers in VBA



Valex
12-05-2005, 12:28 PM
Hi
Have somebody use the Complex Numbers Functions like IMPRODUCT or IMDIV in VBA function?
Thanks in advance

Valex
12-05-2005, 12:29 PM
Sorry, something went wrong during posting the message.
The actual question is related to correct extracting the complex number from the function and placing it into a cell ready for another operation with excel complex functions.

Thanks

Norie
12-05-2005, 01:25 PM
To use those functions in VBA you would need to set a reference to atpvbaen.xls in the VBA editor under Tools>References...

I've never used these functions in Excel or VBA so I don't know what the synyax/code would be for what you want to do.

Valex
12-05-2005, 02:31 PM
Thanks Norie

Having a cell name ww ="2+2j", the function is

Function GatFsw(ww)
GatFsw = WorksheetFunction.IMPRODUCT(ww, 2)
End Function

The function is called by GatFsw(ww) and terurns #VALUE!

On the other side cell =IMPRODUCT(ww,2) is returning correct result 4+4j

Norie
12-05-2005, 02:41 PM
Valex

Try removing WorksheetFunction.

Zack Barresse
12-05-2005, 03:21 PM
If you have your reference set right (VBE | Tools | References) then you just call them on their own, they are not part of the WorksheetFunction object.

Syntax is:
IMPRODUCT(number1, number2, number3...number 29)