View Single Post
 
Old 04-25-2013, 04:28 PM
ue418 ue418 is offline Windows 7 32bit Office 2000
Novice
 
Join Date: May 2012
Posts: 17
ue418 is on a distinguished road
Default Simple Macro help for Excel Solver

I have a simple macro that performs a Solver routine. For one of my variables (cell AF61), I have two constraints:

SolverAdd CellRef:="$AF$61", Relation:=1, FormulaText:="$ak$75"
SolverAdd CellRef:="$AF$61", Relation:=3, FormulaText:="$aj$75"

So this just ensures that AF61 stays between those two limits.

However, I want to specify the value of AF61 right before the solversolve command. I have it in my mind that the "starting value" is important? What I did was just add the following line:

AF61 = (AK75 + AJ75)/2

My goal is to make the "starting value" of AF 61 halfway between AK75 and AJ75 (the limits). That line doesn't fail, but I have no idea if it is the right way to specify a cell value in VBA! There are no Dim statements in the solver macro, so I assume the dimensioning has already been taken care of internally. Is there a way to specify the value of cell AF61 in the macro like this? Thanks a lot for any help.
Reply With Quote