LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default VBA CODE SOLVER TO RETURN VALUE

On May 26, 5:44 am, Jasper wrote:
Hey there everybody,

while designing a statistical procedure, I was tempted to use Excel 97, for
convinience of extreme oversight. However, I need to solve 16,000
regressions. Not terribelly hard stuff, though the VBA code I designed does
not return any value, or keep the value. This is the code I use, can someone
see where things go wrong? Thanks in advance!

Sub test()
SolverReset
SolverOk SetCell:="$DV$4, MaxMinVal:=2, ValueOf:=1", ByChange:="$DV$4"
SolverSolve UserFinish:=False
'Changing userfinish from false to true does not yield any difference
SolverFinish KeepFinal:=1
'Changing this line into SolverFinish KeepFinal:=1, ReportArray:=1, will
only yield an error on the lack of availability of memory
End Sub


Jasper,

It is not clear to me what you are trying to do. It appears that you
are setting the objective function equal to a single variable. But
they refer to the same cell which won't work.

When you say "return a value" that is not clear to me either as to
what value you want returned. To return the solution status of a
model, you simply declare an integer variable and set that equal to
the SolverSolve function. e.g.,

Dim retVal as Integer
retVal = SolverSolve(UserFinish:=False) 'False if you want the Solver
completion dialog window to appear
MsgBox retVal

The last point I can make it is that if you mean by 16,000 regressions
you have 16,000 variables then your model exceeds the variable
capacity of the Premium Solver Platform which is 8000 variables. So
unless you've bought a third-party solver like MOSEK or XPRESS, you
can't solve a problem that large using Frontline. And if you do have
a copy of MOSEK or XPRESS you probably don't want to be using
Frontline for model management anyway.

SteveM

P.S. You can do linear regression via LP, but with the statistics
packages available why would you?
 
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
Solver bug - Won't return Integer GeoJack Excel Discussion (Misc queries) 3 December 16th 06 09:15 PM
Solver GUI works fine, but the VBA macro won't return any results Ben Anderson Excel Programming 3 June 24th 05 02:48 PM
Help with Solver Code Paul Excel Programming 1 May 14th 05 05:43 AM
Why will solver only return the original adjustable cell values? Del Excel Worksheet Functions 0 March 3rd 05 12:25 AM
VBA Code for Solver David Excel Programming 1 October 21st 04 07:33 PM


All times are GMT +1. The time now is 07:21 PM.

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

About Us

"It's about Microsoft Excel"