+ Reply to Thread
Results 1 to 6 of 6

Overriding Solver "Could not find feasible solution" in VBA?

  1. #1
    Registered User
    Join Date
    06-24-2019
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    3

    Overriding Solver "Could not find feasible solution" in VBA?

    I am currently using Solver to solve for three variables with an objective function. When I run Solver, I frequently get the message "Could not find feasible solution," but the solution that appears is correct. Furthermore, all of the cells appear to meet the constraints specified. I have allowed for negative values for non-constrained cells, which makes sense for my application. When I try to run a feasibility report, Excel crashes, so I am not sure what is going wrong.

    Ultimately, I am trying to automate the solving process using VBA. Is there a way to ignore the error message and put the data in the cells regardless since it is giving me the correct answer anyway? My code is as follows, if that is of any help.

    Please Login or Register  to view this content.
    Last edited by orchemistral; 06-24-2019 at 02:10 PM.

  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,758

    Re: Overriding Solver "Could not find feasible solution" in VBA?

    Difficult to see what the problem is without having your file to work with. Could you upload the file with your solver model?

    Click "Go Advanced" button, in new windows that opens scroll down until you see blue line "Manage Attachments". Click on this and upload file.

    Alf

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

    Re: Overriding Solver "Could not find feasible solution" in VBA?

    Welcome to the board.

    Your SetCell reference appears to be invalid, and Solver might be happier if you squared the result in the SetCell and then changed the model to minimize that cell.

    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with CODE tags.

    Thanks.
    Last edited by shg; 06-24-2019 at 02:08 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-24-2019
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Overriding Solver "Could not find feasible solution" in VBA?

    The SetCell reference is valid in the actual code itself; it was a typo when I copy and pasted it over to the forum. I named some of my functions/macros beginning with the phrase "solver" which I read can corrupt or modify hidden solver variables; could this be the case? I have used solver for this exact problem successfully in a different workbook, but over the past 24 hours everything has gone awry and doesn't seem to be working at all.

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

    Re: Overriding Solver "Could not find feasible solution" in VBA?

    I named some of my functions/macros beginning with the phrase "solver" which I read can corrupt or modify hidden solver variables
    I think the only Solver* names you need to avoid are those you use in VBA:

    SolverAdd
    SolverChange
    SolverDelete
    SolverFinish
    SolverFinishDialog
    SolverGet
    SolverLoad
    SolverMain
    SolverOk
    SolverOkDialog
    SolverOptions
    SolverReset
    SolverSave
    SolverSolve

    But my suggestion for changing your model stands.

  6. #6
    Registered User
    Join Date
    06-24-2019
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Overriding Solver "Could not find feasible solution" in VBA?

    Thanks for the help. Minimizing instead of setting to zero did not help- same errors still occur. The objective function is already a sum of squares, so no negative output is possible. I have a couple alternative Excel and non-Excel methods that have been successful, so I think that I will go down those paths instead of continuing to grapple with Solver. Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem with Solver: "Can't find a feasible solution"
    By whoamiquestionmark in forum Excel General
    Replies: 7
    Last Post: 10-23-2017, 12:58 PM
  2. [SOLVED] "Find the solution" based on Yes or No answers to Questions.
    By singerbatfink in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-03-2017, 09:48 AM
  3. [SOLVED] Macro to loop solver, save results, and skip when there is no feasible solution
    By isotopes88 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2017, 08:27 AM
  4. Replies: 11
    Last Post: 10-30-2013, 02:11 PM
  5. Replies: 2
    Last Post: 09-04-2013, 08:36 PM
  6. [SOLVED] Solver macro... bypass no feasible solution popup
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2012, 05:28 PM
  7. [SOLVED] Why is excel solver saying that there is not a feasible solution?
    By jt13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2006, 01:30 PM

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