none
VBA source code

    Question

  • Hi all.

    I need to do my final year project in Excel using VBA.
    The project is in such a way that i can generate curves using Excel.
    I have been searching for the samples source code for cosine, sine and FFT source code, but to no avail. Could anyne please advise me on this? I am a newbie to VBA, so i'm rather lost now.. Thanks in advance.
    Wednesday, August 31, 2005 3:39 AM

Answers

  • in the VBA Help

    Dim MyAngle, MySecant
    MyAngle = 1.3    ' Define angle in radians.
    MySecant = 1 / Cos(MyAngle)    ' Calculate secant.

    Wednesday, October 19, 2005 5:16 PM
  • The problem is not with the "=COS(", but with the"pi*A2".
    Try:
    =COS(PI()*A2/180)
    Friday, October 21, 2005 10:46 AM

All replies

  • in the VBA Help

    Dim MyAngle, MySecant
    MyAngle = 1.3    ' Define angle in radians.
    MySecant = 1 / Cos(MyAngle)    ' Calculate secant.

    Wednesday, October 19, 2005 5:16 PM
  • Hi Gnomie.

    First of all, thanks for the advice.
    Do you mean that if i add the above source code into the VB editor then i'll be able to calculate secant in excel? how about cosine. i tried to use the formula =COS(pi*A2/180) but the results i obtained is #NAME?. I'm using excel 2003.
    Thursday, October 20, 2005 7:59 AM
  • The problem is not with the "=COS(", but with the"pi*A2".
    Try:
    =COS(PI()*A2/180)
    Friday, October 21, 2005 10:46 AM
  • Thanks Gnomie,

    It works.. :)) By the way, is it possible to draw the cosine graph based on the formula using excel? It seems like, i can only plot the graph based on the values keyed in the tables. Furthemore the graph obtained using the excel's Chart>XY Scatter doesn't look like cos graph. Do i need to write a program in order to to draw the cosine graph?
    Saturday, October 22, 2005 3:29 AM
  • Sorry Mate, Graphs are not my area of knowledge...
    Tuesday, November 01, 2005 5:04 PM
  • No problem.
    Thanks alot for your help:))
    Wednesday, November 02, 2005 6:39 AM