+ Reply to Thread
Results 1 to 9 of 9

Help to make solver recalculate upon parameter change

  1. #1
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Help to make solver recalculate upon parameter change

    I'm using solver to optimise a product mix, this is working fine.

    I would appreciate some help on how to get solver to recalculate automatically upon a change of any of the parameters.

    I'm assuming this would need to be done via vba.

    Sample file attached
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Help to make solver recalculate upon parameter change

    1) make sure in VBA references SOLVER is enabled (see picture)
    2) rightclick on sheet tab and Display code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    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: Help to make solver recalculate upon parameter change

    You could also set the min and max constraint for production using two lines i.e.

    Please Login or Register  to view this content.
    Alf

  4. #4
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help to make solver recalculate upon parameter change

    Thanks for the reply's

    Kaper, the vba you have posted fails when I change a parameter in the range B4:G5.

    Alf, yes I realised I could do that after reading your reply, thanks

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Help to make solver recalculate upon parameter change

    Have you enabled reference to Solver in Visual Basic Editor? (Sorry, picture was not attached to previous post)

    PS. To see how solver stopped (may be not found satisfactory solution? change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    or just
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by Kaper; 09-29-2015 at 04:06 PM.

  6. #6
    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: Help to make solver recalculate upon parameter change

    The way the model is set up you have negative amount of "Amt left" on Material 2, 5 and 7 this causes Solver to go infeasible ( as Kaper suggested) so there will be no change of values i.e. a Solver run untill you fixed that.

    Looking at the formula in K7 to K13 should it not include the G column? I.e. "=SUMPRODUCT(B7:G7;$B$15:$G$15)" for K7 for instance.

    Alf

  7. #7
    Forum Contributor
    Join Date
    06-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    272

    Re: Help to make solver recalculate upon parameter change

    Thank you both for your help, all is working well now.

  8. #8
    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: Help to make solver recalculate upon parameter change

    Thanks for feedback and rep.

    Alf

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Help to make solver recalculate upon parameter change

    I'd like also say:
    THNX!

+ 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. [SOLVED] Parameter Relationship with VBA Solver Loop
    By mea23 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-03-2015, 01:41 PM
  2. automatically recalculate value after change
    By jveeken in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2014, 09:16 AM
  3. [SOLVED] How can I make excel recalculate whole workbook when change made to one cell?
    By ndtsteve in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-14-2012, 07:47 AM
  4. Parameter Convergence with Solver
    By PDK in forum Excel General
    Replies: 0
    Last Post: 07-22-2009, 11:18 AM
  5. How can I make excel refresh / recalculate after entering data into a cell?
    By nish1585 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2008, 05:31 PM
  6. Solver parameter constraint question
    By Morrigan in forum Excel General
    Replies: 7
    Last Post: 06-08-2005, 11:05 AM
  7. [SOLVED] Can you make excel automatically recalculate every x seconds?
    By ADW in forum Excel General
    Replies: 0
    Last Post: 02-18-2005, 10:06 AM

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