+ Reply to Thread
Results 1 to 7 of 7

Solver... compile error

  1. #1
    Forum Contributor
    Join Date
    04-19-2009
    Location
    Toulouse, France
    MS-Off Ver
    Excel 2010
    Posts
    130

    Solver... compile error

    hi all have the following code and as usual can't figure out where the problem is. getting compile error sub or function not defined. any help appreciated.
    Regards
    Dan

    Please Login or Register  to view this content.
    Last edited by Cicada; 04-25-2012 at 12:32 PM. Reason: Solved

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Solver... compile error

    Could this be your problem?

    Before you can use the Solver VBA functions in the Visual Basic Editor, you must establish a reference to the Solver add-in. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.
    Alf

  3. #3
    Forum Contributor
    Join Date
    04-19-2009
    Location
    Toulouse, France
    MS-Off Ver
    Excel 2010
    Posts
    130

    Re: Solver... compile error

    Thanks Alf that was it. Thanks for your help. When i run it now i am getting the popup solver could not find a feasible solution which is fine though could i add something to that code to prevent this popup from appearing. secondly the initial call is not working when I run it it solves automatically even though there is no "y" in j14. Any ideas what i am doing wrong. Thanks again

    Regards
    Dan

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Solver... compile error

    Not familiar with Solver in Excel 2010 but this line puzzles me

    Please Login or Register  to view this content.
    As far as I know you either use the "Simplex method" (engine1) or the "GRG Nonlinear" (engine2) but this looks to me like both methods are called. Still I'm unsure if this is the problem.

    Could you just test that the macro "Freeme" fires only when you add a "Y" to cell J14 i.e. a code snippet that makes "Freeme" just writes "Ok" to a cell.

    Or you could upload the file.

    Alf

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Solver... compile error

    This code runs solver when a value is entered in J14

    Please Login or Register  to view this content.
    Works for Excel 2003 and 2007 don't know about Excel 2010. Not exactly what you asked for i.e. you wanted the target value to be "Y" as well but at least it only fires when a value is entered in J14. All other inputs ignored.

    Alf

  6. #6
    Forum Contributor
    Join Date
    04-19-2009
    Location
    Toulouse, France
    MS-Off Ver
    Excel 2010
    Posts
    130

    Re: Solver... compile error

    Thanks Alf for your time much appreciated. got it sorted.

    Regards
    Dan

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Solver... compile error

    Hi Dan

    Glad you got your problem sorted out. Just out of curiosity and a whish to learn more could you please post your solution?

    Alf

+ 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