View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA complex numbers

Actually you don't have to do that

sStr = Application.Run("ATPVBAEN.XLA!IMPRODUCT","3+4i","5-3i")

so to demonstrate from the immediate window:

sStr = Application.Run("ATPVBAEN.XLA!IMPRODUCT","3+4i","5-3i")
? sStr
27+11i

This assume the Analysis Toolpak - VBA has been selected in Tools=Addins.

If you create a reference to ATPVBAEN.XLA you can call it like a built in
VBA function

sStr = IMPRODUCT("3+4i","5-3i")

but to the best of my knowledge, VBA itself does not support complex
numbers.

--
Regards,
Tom Ogilvy

"Levent" wrote in message
...
Hello

I was just wondering if there is a data type called
complex (i.e. for operations with complex numbers) in any
version of VBA for Excel.

I am aware that you can use Excel functions for this, but
I was wondering if VBA can deal with it also.

because if i use the Excel functions in VBA. i have to do

Range("something").formula = "IMPRODUCT(whatever)"

and have to read that again back into VBA

somevariable = Range("something")
(if anyone can think of a more efficient way, that would
also do)