+ Reply to Thread
Results 1 to 6 of 6

Cos & Sin WorksheetFunction

  1. #1
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Cos & Sin WorksheetFunction

    I used the loop code below in Microsoft Visual Studio 8 and am trying to get it to work in Excel’s VBA. The Cos and Sin function seem to be the problem, is there any way to get it to work?

    Thanks Sandy.


    Please Login or Register  to view this content.
    My only thought was to some how get Fun_3 by writing the Fun_1 and Fun_2 formula into Excel during a Loop until Fun_1 = 0??

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Cos & Sin WorksheetFunction

    Sin and Cos are native functions in VBA.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Re: Cos & Sin WorksheetFunction

    Thanks for that, I must have other problems which I will try to sort.
    Sandy

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Cos & Sin WorksheetFunction

    You've got more variables than you need, and you initialize two of them from the same cell, which looks dubious.
    Please Login or Register  to view this content.
    EDIT: Also, you should probably be looping until Fun1 is less than (perhaps in absolute value) some epsilon.
    Last edited by shg; 09-13-2009 at 04:46 PM.

  5. #5
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Re: Cos & Sin WorksheetFunction

    Thanks SHD, now we are winning. My maths is a little rusty.
    Sandy

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Cos & Sin WorksheetFunction

    Sandy, you could do this instead with Solver. It would probably be faster.

    You could also automate Solver to do it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1