ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Solver Code (https://www.excelbanter.com/excel-programming/329341-help-solver-code.html)

Paul

Help with Solver Code
 
I am using a solver reference in my code like this:

SolverOk SetCell:="$c$22", MaxMinVal:=3, ValueOf:="0", ByChange:="$c$18"
SolverSolve (True)

However I need to do this repetitively so I would like to change $c$22 to
something like (looper+5,5). However, when I try to use a cell reference like
that, I get an error message. Thanks for the help.


--
Paul

Michael Bednarek[_8_]

Help with Solver Code
 
On Fri, 13 May 2005 11:32:02 -0700, "Paul" wrote in microsoft.public.excel.programming:

I am using a solver reference in my code like this:

SolverOk SetCell:="$c$22", MaxMinVal:=3, ValueOf:="0", ByChange:="$c$18"
SolverSolve (True)

However I need to do this repetitively so I would like to change $c$22 to
something like (looper+5,5). However, when I try to use a cell reference like
that, I get an error message. Thanks for the help.


Maybe this can help:
strCell = Cells(looper + 5, 5).Address
SolverOk SetCell:=strCell, MaxMinVal:=3, ValueOf:="0", ByChange:="$c$18"
or shorter:
SolverOk SetCell:=Cells(looper + 5, 5).Address, MaxMinVal:=3, ValueOf:="0", ByChange:="$c$18"

Depending on your circumstances, you may need to qualify Cells().

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com