FFT usage in Macro

B

bandy2000

hi,

How can I use the FFT Add In in a Macro?
How can I use the Engineering Functions in a Macro?
Maybe someone can provide short example codings
Thanks
 
C

Chip Pearson

If you are talking about the functions in the Analysis Tool Pack,
you need to set a reference to the ATP VBA add-in. In Excel, go
to the Tools menu, choose Add-Ins, and select "Analysis Tool Pak
VBA" from the list and put a check next to it. Then, go to the
VBA Editor, choose the Tools menu, then References. In that
dialog, put a check next to "ATPVBAEN.xla". Once you do this,
you can use the ATP functions as if they were built in VBA
functions.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


message
news:[email protected]...
 
R

ross

I don't kno what fuction you are talking about but

try perfixing the fuctoion with "worksheetfunction"

from excel help!

Set myRange = Worksheets("Sheet1").Range("A1:C10")
answer = Application.WorksheetFunction.Min(myRange)
MsgBox answer
 
B

bandy2000

HI,
Thanks for the info. I did what you told to do. Then I used the Macro
Recorder and it came out to use the FFT like this:

Application.Run "ATPVBAEN.XLA!Fourier", , "ResultFFT", False , False

Where do I find further information on the options for the Fourier Function.
There is nothing in the Help Infromation in VBA or at least I can't find it.
For Example where do I enter the Range etc....
 
B

bandy2000

Thanks again Tom,

exactly what I wanted to have!!
At the moment I'm using these files as "Standalone" is it possible to invoke
them into the standard Excel / VBA help?
 
T

Tom Ogilvy

I think there is an xl2000 version of them - but I recall Myrna Larson
saying something about a problem with these - perhaps it was that they don't
work (at least not integrated like you ask) on other versions. . . . I
found one

Here is one posting; (it also has the link to the xl2000 version)

Hi, Tom:

For your first suggestion, have they updated this EXE file so it will
install
under Excel XP and/or Excel 2003? When I tried a year or so ago, it required
XL2000 to be installed. I finally got the folks in the MVP section to
persuade
the development team to send me a copy of the embedded CHM file.

Myrna Larson
 
D

Dana DeLouis

One of the easiest ways would be to go to the vba editor, and select Tools |
References | and select "atpvbaen.xls."
Then you can write code along this line...

Sub Demo()
Dim c
c = complex(3, 4)
Debug.Print c
Debug.Print ImAbs(c)

'// Fourier is a Subroutine
'// Use Ranges for Input / Output
Fourier [A1:A8], [B1:B8], False, False
End Sub

which prints:

3+4i
5


If you don't wish to set a vba library reference, here is another option. I
added some ideas that I use...

Sub Demo()
Const InverseFFT As Boolean = True
Const ForwardFFT As Boolean = False

Const NoLabels As Boolean = False
Const Labels As Boolean = True

Const FFT As String = "ATPVBAEN.XLA!Fourier"

Run FFT, _
ActiveSheet.Range("A1:A8"), _
ActiveSheet.Range("B1"), _
ForwardFFT, _
NoLabels

End Sub


HTH :>)
 

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