View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Wright Ken Wright is offline
external usenet poster
 
Posts: 634
Default SolverOK problem - very frustrated, please help

Previously posted by Dana de Louis:-

For you reference, I am running Windows 2000, Excel 2000
SP-3


XL2000: The Solver Add-in May Not Work When You Start Solver by Using a
Macro

http://support.microsoft.com/default...30&Product=xlw

CAUSE
This problem may occur after you install Microsoft Office 2000 Service Pack
3 (SP-3).

HTH.

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


--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"Daniel E" wrote in message
...
ok, i am trying to invoke the solver from my VB code. The code works (solves)

every time on MS Excel 2000 SP-1, and does not work on MS Excel 2000 SP-3. I
have tried this on many different machines.

I need to distribute my code to other Excel users, many of which are using

Excel 2000 SP-3, so this is a big problem.

ON SP3: I press "solve" and nothing happends, no error message. Has anyone

else experienced this?
Solverreset works
SolverOptions works (i checked, it actually changed the options in the solver)
SolverAdd works (it adds the constraints)
SolverOK does not work (SetCell and ByChange do NOT work, MinMaxVal and

ValueOf work)
SolverSolve does not work (makes sense, since SetCell and and ByChange are

left blank in the solver)

Any ideas?

Here is the code:

Private Sub SolveIt()
'
' SolveIt Macro
' Macro recorded 12/12/2003 by Tim Anderson
'
Application.ScreenUpdating = False
Count = Range("MatrixL").Count
NumRows = Sqr(Count)

'Reset the Solver
solvreset
SolvOptions MaxTime:=100, Iterations:=100, Precision:=0.000001, AssumeLinear _
:=False, StepThru:=False, Estimates:=1, Derivatives:=1, SearchOption:=1, _
IntTolerance:=5, Scaling:=True, Convergence:=0.0001, AssumeNonNeg:=False

'Insert new constraints
For i = 1 To NumRows
SolvAdd CellRef:=Range("MatrixLLT").Cells(i, i), Relation:=2,

FormulaText:="1"
Next i

'Set objective function and decision variables, then solve
For j = 1 To 3
SolverOK SetCell:="Objective", MaxMinVal:=2, ValueOf:="0",

ByChange:="DecVars"
SolverSolve UserFinish = False
Next j

SolverOK SetCell:="Objective", MaxMinVal:=2, ValueOf:="0", ByChange:="DecVars"
SolverSolve UserFinish = True

End Sub



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004