View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Solver GUI works fine, but the VBA macro won't return any results

In addition to needing the reference to the Solver add-in, something
else that helps (but unfortunately not 100% of the time) is to add,
before any other Solver code, the statement SOLVER.Auto_open

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I'm using the Solver add-in (Excel 2000) to do a power regression on a data
set. If I use the GUI (menus, point-n-click, etc.) it works great.

I want to use this as part of a larger macro, so I recorded my actions to
VBA code. If I try running the macro, nothing happens. I don't get any
warnings or errors; Excel runs the macro just fine, but there are no results.
I've tried changing the SolverSolve argument "userFinish" between True and
False, and changing the SolverFinish argument "KeepFinal" between 1 and 2,
but nothing is helping. The applicable code is pasted below.

Minimum I've tried:
SolverOk SetCell:="$D$1", MaxMinVal:=3, ValueOf:="0", ByChange:="$A$1:$B$1"
SolverSolve

My most verbose effort:
SolverReset
SolverOk SetCell:="$D$1", MaxMinVal:=2, ValueOf:="0", ByChange:="$A$1:$B$1"
SolverOptions MaxTime:=10, Iterations:=200, Precision:=0.00000001, _
AssumeLinear:=False, StepThru:=False, Estimates:=1, _
Derivatives:=1, SearchOption:=1, IntTolerance:=5, Scaling:=False, _
Convergence:=0.00000001, AssumeNonNeg:=False
SolverOk SetCell:="$D$1", MaxMinVal:=2, ValueOf:="0", ByChange:="$A$1:$B$1"
SolverSolve userFinish:=False
SolverFinish KeepFinal:=1

Thanks in advance.