Results 1 to 1 of 1

row automation (solver)

Threaded View

  1. #1
    Registered User
    Join Date
    02-11-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    98

    row automation (solver)

    I am trying to automate the rows in a solver code that I am writing. Ideally the macro would find the 1st row of data and the last on its own. Right now I have data starting in row 15 and I have calculated the final row as a variable. I want to be able to delete rows in the table of data and have solver automatically adjust the ranges and constraints. any tips/suggestions would be fantastic....

    Sub Wealth_Solver2()
     
     finalrow = Cells(Rows.Count, 5).End(xlUp).Row
    'target
            
            
        SolverOk SetCell:="$h$15", MaxMinVal:=1, ByChange:=Range("$i$15:$J$finalrow").Address
    
    'constraints
              
              '> than
           SolverAdd CellRef:=Range("$h$15:$H$finalrow").Address, Relation:=3, FormulaText:="0"
           SolverAdd CellRef:=Range("$i$15:$J$finalrow").Address, Relation:=3, FormulaText:="0"
           SolverAdd CellRef:=Range("$c$15:$d$finalrow").Address, Relation:=3, FormulaText:="0"
                       
           SolverAdd CellRef:=Cells(finalrow, 5).Address, Relation:=3, FormulaText:="0"
                 
            '< than
    SolverAdd CellRef:=Range("$k$15:$k$finalrow").Address, Relation:=1, FormulaText:=Range("$e$15:$e$finalrow")
                
                
                
             
            
                    
            SolverSolve UserFinish:=False 'true= don;t show result box
        
    
    End Sub
    Last edited by dabrows; 02-25-2011 at 11:39 AM.

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