Results 1 to 2 of 2

solver for multiple cells

Threaded View

  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    1

    solver for multiple cells

    Hi,

    I have created the following code to use solver when a cell is updated by a formula. It works fine.

    Private Sub Worksheet_Calculate()
    'Runs Macro when formula calculated
    SolverReset
    SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
    :=1, EngineDesc:="GRG Nonlinear"
    SolverAdd CellRef:="$M$86", Relation:=2, FormulaText:="$G$86"
    SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
    :=1, EngineDesc:="GRG Nonlinear"
    SolverOk SetCell:="$M$86", MaxMinVal:=1, ValueOf:=0, ByChange:="$N$86", Engine _
    :=1, EngineDesc:="GRG Nonlinear"
    SolverSolve userFinish:=True
    
    End Sub
    Is there a way I can make the solver function do this for another 50 rows directly below row 86 detailed above?

    The formulas and cells will be the same but just a row down.

    Is there a way I can make the macros run only when the cell for that row is modified. I am worried it will be a slow running worksheet if it is fired up eveytime a calculation is made.

    Thanks in advance
    Kyle
    Last edited by kyle02; 05-11-2011 at 08:52 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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