Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Complex Numbers

How do I do complex numbers in Visual Basic for Excel. I
installed the analysis add in so I can now do it in
Excel. However, I want Visual Basic to manipulate
complex numbers in my program. This is part of my basic
code that doesn't work. Thanks for the help.

wks_W.Range("AY" & i).Value = WorksheetFunction.complex
(1, 2)

or

wks_W.Range("AY" & i).Value = complex(1, 2)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Complex Numbers

Here are two ways.

In the vba editor, if you do "Not" have the following checked...
Tools|References... and a check on "atpvbaen.xls" then here is one way that
I use:

Sub Demo1()
Dim x
Const ImAbs As String = "ATPVBAEN.XLA!ImAbs"
x = Run("ImABS", "3+4i")
End Sub


However, if you do select "atpvbaen.xls", then it's much easier:

Sub Demo2()
Dim x
x = ImAbs("3+4i")
'or your example:
Range("A1") = Complex(1, 2)
End Sub


HTH
Dana DeLouis


wrote in message
...
How do I do complex numbers in Visual Basic for Excel. I
installed the analysis add in so I can now do it in
Excel. However, I want Visual Basic to manipulate
complex numbers in my program. This is part of my basic
code that doesn't work. Thanks for the help.

wks_W.Range("AY" & i).Value = WorksheetFunction.complex
(1, 2)

or

wks_W.Range("AY" & i).Value = complex(1, 2)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I format complex numbers ? ks Excel Discussion (Misc queries) 5 April 5th 23 01:14 PM
Operating on Complex Numbers Charles Excel Discussion (Misc queries) 3 May 24th 10 10:50 PM
VBA: Calculating Complex Numbers LenS Excel Discussion (Misc queries) 0 January 8th 07 05:24 PM
Round-down complex numbers nsv Excel Discussion (Misc queries) 7 February 2nd 06 03:37 PM
Complex numbers Alain Turgeon Excel Programming 2 June 1st 04 09:19 PM


All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"