Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using the Solver in a VBA function (not a macro)
Hi, I got some kind of a standard problem but could not find any solution for it up to now. Here the setting: I want to program a VBA function (not a macro!). The function should optimize some expression depending on its input parameters (a, b, and c) by using the Solver (e.g. I want to call Solver for getting a solution rather than programing some iterations myself). E.g. something like the following will be required: Function SolverInVBA(a, b, c) x = 0 'some dummy as starting point for the optimization y = a * x^2 + b * x + c 'just some stupid example SolverReset -----------------Here comes the problem----------------- SolverOk SetCell:="y"(???), MaxMinVal:=2, ByChange:="x"(???) SolverSolve UserFinish:=True SolverFinish KeepFinal:=1 SolverInVBA = "Solution of Solver"(???) --------------------------------------------------------- End Function The points where I have problems are marked with "(???)". In addition, how do I tell the function to update once one of its input parameters has changed? Has anybody an idea how to implement this? Best, Felix -- fm78 ------------------------------------------------------------------------ fm78's Profile: http://www.excelforum.com/member.php...o&userid=30370 View this thread: http://www.excelforum.com/showthread...hreadid=500249 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Solver function | Excel Programming | |||
how to write a macro for solver function | Excel Programming | |||
Solver Record Macro Function | Excel Programming | |||
is there anyway to call the Solver add-in as a function? | Excel Programming | |||
Calling up the Solver function in a VBA macro | Excel Programming |