Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Solver in VBA I created the following little macro:
Sub SolverMacro() ' My Example of a Solver VBA Macro using variables Dim rng1 As Variant Dim rng2 As Variant Dim rng3 As Variant rng1 = "$BL$11:$BL$58" rng2 = "$BR$58" rng3 = "$BL$11:$BL$58" SolverReset SolverOk SetCell:=rng1, _ MaxMinVal:=3, _ ValueOf:="0", _ ByChange:=rng2 SolverAdd CellRef:=rng3, Relation:=3, FormulaText:="0" SolverSolve End Sub Needless to say it would not repeat, it would go thru the code but change nothing. I then created a macro with the macro recoder: Sub Macro2() SolverOk SetCell:="$BR$58", MaxMinVal:=1, ValueOf:="0", ByChange:= _ "$BL$11:$BL$58" SolverSolve End Sub However like the first macro it would not repeat. When I try to use it again it goes thru the routine but changes nothing. I made manual changes to the range "$BL$11:$BL$58" to check if the macro was working and it changed nothing When I use the solver by manually entering the data into the solver fields it works ok. What am I doing wrong and how do I get Solver to work more than time using VBA |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Solver installes itself a second time :S | Excel Worksheet Functions | |||
loop to excute data | Excel Programming | |||
How to use solver to schedule part time and full time workforce? | Excel Discussion (Misc queries) | |||
error to excute cut or copy in vba programming | Excel Programming | |||
Excute a Excel worksheet with Task Scheduler | Excel Programming |