Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Solver constraints not added

This is driving me crazy. Trying to use Excel's solver, using the
following code:

Sub findshiftconversion()
SolverReset
SolverOk SetCell:="Gfinal", MaxMinVal:=2, ByChange:="SHconv"
SolverAdd CellRef:="SHconv", Relation:=1, FormulaText:=1
MsgBox (solverget(5, "sheet1"))
SolverAdd CellRef:="SHconv", Relation:=3, FormulaText:=0
MsgBox (solverget(5, "sheet1"))
SolverSolve
End Sub

SHconv and Gfinal are single-cell named ranges on sheet1. The proper
reference to solver.xla has been set. The code executes, but refuses
to put in the first constraint (i.e., the first SolverAdd statement
doesn't do anything). This is obvious from the solverget values,
which return 0 on first call, and 1 on second call. The same happens
when I record the macro - Excel puts in extra junk and doesn't name
the ranges in the code, but it amounts to a similar macro. It does
what it needs to do when I record the macro, but doesn't work when I
try to replay it. (The constraint is essential, otherwise Excel gets
into numerical problems). Anyone know how to get around this?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Solver constraints not added

Don't know, so just a guess.

XL2000: The Solver Add-in May Not Work When You Start Solver by Using a
Macro
http://support.microsoft.com/default...30&Product=xlw

HTH.
--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Rob" wrote in message
om...
This is driving me crazy. Trying to use Excel's solver, using the
following code:

Sub findshiftconversion()
SolverReset
SolverOk SetCell:="Gfinal", MaxMinVal:=2, ByChange:="SHconv"
SolverAdd CellRef:="SHconv", Relation:=1, FormulaText:=1
MsgBox (solverget(5, "sheet1"))
SolverAdd CellRef:="SHconv", Relation:=3, FormulaText:=0
MsgBox (solverget(5, "sheet1"))
SolverSolve
End Sub

SHconv and Gfinal are single-cell named ranges on sheet1. The proper
reference to solver.xla has been set. The code executes, but refuses
to put in the first constraint (i.e., the first SolverAdd statement
doesn't do anything). This is obvious from the solverget values,
which return 0 on first call, and 1 on second call. The same happens
when I record the macro - Excel puts in extra junk and doesn't name
the ranges in the code, but it amounts to a similar macro. It does
what it needs to do when I record the macro, but doesn't work when I
try to replay it. (The constraint is essential, otherwise Excel gets
into numerical problems). Anyone know how to get around this?
Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set solver constraints so variables are either 1 OR 0. Gwyndalf Excel Worksheet Functions 3 May 28th 08 06:44 PM
Solver Constraints twa14 Excel Discussion (Misc queries) 2 October 13th 07 01:10 PM
Excel Solver constraints Dan Excel Worksheet Functions 1 July 13th 07 03:50 PM
Excel Solver Constraints jcoleman52 Excel Discussion (Misc queries) 2 June 1st 06 08:00 PM
Solver Constraints Rick Excel Discussion (Misc queries) 15 March 9th 05 03:17 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"