+ Reply to Thread
Results 1 to 6 of 6

Optimization with solver

  1. #1
    Registered User
    Join Date
    12-04-2008
    Location
    Zagreb
    Posts
    9

    Optimization with solver

    Hello,
    For my optimization problem I use solver function which parametars are changed depending of some data is checked or not for calculation.
    My problem is how to define parameter ByChange:= in solver function
    I tried to use array of range but that doesn't work
    Here is my code
    Please Login or Register  to view this content.
    Please help

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Optimization with solver

    Source Excel VB help:

    SolverOk Function

    Before you use this function, you must establish a reference to the Solver add-in. With a Visual Basic module active, click References on the Tools menu, and then select the Solver.xla check box under Available References. If Solver.xla doesn't appear under Available References, click Browse and open Solver.xla in the \Office\Library\Solver\ subfolder.

    SolverOk(SetCell, MaxMinVal, ValueOf, ByChange)

    SetCell Optional Variant. Refers to a single cell on the active worksheet. Corresponds to the Set Target Cell box in the Solver Parameters dialog box.

    MaxMinVal Optional Variant. Corresponds to the Max, Min, and Value options in the Solver Parameters dialog box.

    MaxMinVal Specifies
    1 Maximize.
    2 Minimize.
    3 Match a specific value.


    ValueOf Optional Variant. If MaxMinVal is 3, you must specify the value to which the target cell is matched.

    ByChange Optional Variant. The cell or range of cells that will be changed so that you’ll obtain the desired result in the target cell. Corresponds to the By Changing Cells box in the Solver Parameters dialog box.

  3. #3
    Registered User
    Join Date
    12-04-2008
    Location
    Zagreb
    Posts
    9

    Re: Optimization with solver

    Thanks for your answer but maybe I wasn't to clear with my queastion. Slover function is working in my code but only if I specifie for ex. ByChange="a5" etc

    But what I wanted to do is array of a range ( I(j) in my code) which I put in function solver as an argument for (ByChange:=I)

    Is that possible?

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Optimization with solver

    try this way:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-04-2008
    Location
    Zagreb
    Posts
    9

    Re: Optimization with solver

    Quote Originally Posted by watersev View Post
    try this way:

    Please Login or Register  to view this content.
    nope, doesn't work
    I created a string with all names of cells which I need in my range and then put it as a argument for solver function

    Problem solved

    BR

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

    Re: Optimization with solver

    Hi Homeboy_8

    ” I created a string with all names of cells which I need in my range and then put it as an argument for solver function

    Problem solved”
    As I’m most interested to learn could you please explain your solution in a bit more detail.

    And even if you solved your problem yourself, could you still mark this post as “Solved” this may help somebody with a similar problem.

    Regards

    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