Results 1 to 8 of 8

VBA Solver for Multiple Rows

Threaded View

sroy316 VBA Solver for Multiple Rows 01-15-2020, 01:53 AM
Alf Re: Need urgent help with VBA... 01-15-2020, 02:14 AM
sroy316 Re: Need urgent help with VBA... 01-15-2020, 04:31 AM
Pepe Le Mokko Re: Need urgent help with VBA... 01-15-2020, 03:20 AM
Pepe Le Mokko Re: VBA Solver for Multiple... 01-15-2020, 03:22 AM
Alf Re: VBA Solver for Multiple... 01-15-2020, 10:13 AM
sroy316 Re: VBA Solver for Multiple... 01-15-2020, 03:26 PM
Alf Re: VBA Solver for Multiple... 01-15-2020, 03:55 PM
  1. #1
    Registered User
    Join Date
    01-15-2020
    Location
    Newark, USA
    MS-Off Ver
    2016
    Posts
    3

    Exclamation VBA Solver for Multiple Rows

    Hello,

    I am trying to solve a cost optimization problem related to electricity generation and load. I am having trouble in editing the solver code for multiple rows (from 5 to 8764). I have tried this but this does not work and is showing error:

    Sub Macro1()
    Dim i As Integer
    ActiveWorkbook.ActiveSheet.Activate
    For i = 5 To 8764
    
        SolverOk SetCell:="$L$" &i, MaxMinVal:=2, ValueOf:=0, ByChange:="$G$" & i &"$J$"&i, _
            Engine:=1, EngineDesc:="GRG Nonlinear"
        
        SolverAdd CellRef:="$G$" & i, Relation:=1, FormulaText:="$V$25"
        
        SolverAdd CellRef:="$G$" & i, Relation:=3, FormulaText:="$U$25"
      
        SolverAdd CellRef:="$H$" & i, Relation:=1, FormulaText:="$V$26"
        
        SolverAdd CellRef:="$H$" & i, Relation:=3, FormulaText:="$U$26"
       
        SolverAdd CellRef:="$I$" & i, Relation:=1, FormulaText:="$V$27"
        
        SolverAdd CellRef:="$I$" & i, Relation:=3, FormulaText:="$U$27"
        
        SolverAdd CellRef:="$J$" & i, Relation:=1, FormulaText:="$V$28"
       
        SolverAdd CellRef:="$J$" & i, Relation:=3, FormulaText:="$U$28"
    
        SolverAdd CellRef:="$K$" & i, Relation:=2, FormulaText:="$D$" & i
      
        SolverSolve = True
    
    End Sub
    Last edited by Pepe Le Mokko; 01-15-2020 at 03:20 AM. Reason: Add code tags and remove urgency

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Solver in a Loop for multiple rows by changing multiple columns
    By glauberpontes in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-30-2018, 01:45 PM
  2. Running Solver on Multiple Rows
    By Boilermaker24 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-16-2018, 03:29 PM
  3. Need URGENT help please - SOLVER
    By targus92 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-21-2016, 06:06 AM
  4. Urgent Help Needed! - Deleting rows by multiple conditions
    By shivboy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-01-2014, 04:54 AM
  5. [SOLVED] Using "SOLVER" to match two columns, but how to copy it for multiple rows ??? (URGENT)
    By hshahad in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2013, 11:31 AM
  6. Need urgent help with solver. It does not change value
    By mikelowrey36 in forum Excel General
    Replies: 1
    Last Post: 04-09-2013, 08:09 AM
  7. Replies: 1
    Last Post: 03-17-2013, 06:52 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