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: 1
Default 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

 
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 function Mahendhra Excel Programming 1 December 28th 05 06:11 AM
how to write a macro for solver function ernestgoh[_2_] Excel Programming 3 October 14th 05 06:22 PM
Solver Record Macro Function Floyd Bates Excel Programming 2 October 13th 04 01:47 PM
is there anyway to call the Solver add-in as a function? Tushar Mehta Excel Programming 0 September 2nd 04 04:07 PM
Calling up the Solver function in a VBA macro Ken Wright Excel Programming 3 January 28th 04 04:21 PM


All times are GMT +1. The time now is 11:59 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"