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 Solver: 2nd function of SolverSolve


Hello. New guy here so please be gentle. :)

From searching the internet, I've learned that the 2nd function of
SolverSolve can be called to count the number of iterations performed
by Solver, ie:

SolverSolve (1st_function, 2nd_function).


Here's the code I found, however I can not make it to run. Where do I
put the code in the VBA program? I mean what would be the complete
SolverSolve command?


Code:
--------------------
Global count as integer

Sub test()
count = 0
ret = solveroptions(stepthru:=True) '"checks" the Show Iteration checkbox in Tools/Solver/Options
ret = solversolve(True, "showtrial")
MsgBox count
End Sub

Function showtrial(reason As Integer)
If reason = 1 Then 'reason = 1 means that the function will be called on each iteration.
count = count + 1 'increments global variable
End If
showtrial = 1 ' continues Solver
End Function
--------------------


Thanks in advance!


--
zaina
------------------------------------------------------------------------
zaina's Profile: http://www.excelforum.com/member.php...o&userid=24316
View this thread: http://www.excelforum.com/showthread...hreadid=379230

 
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 problem where 'IF Function' is bad David Adamson Excel Discussion (Misc queries) 5 September 23rd 05 06:10 AM
is there anyway to call the Solver add-in as a function? Tushar Mehta Excel Programming 0 September 2nd 04 04:07 PM
is there anyway to call the Solver add-in as a function? Jerry W. Lewis Excel Programming 0 September 2nd 04 01:21 PM
How does Solversolve Control Macro Dacvid Cardner Excel Programming 1 June 17th 04 07:41 PM
How to call SolverSolve portably for Excel XP and Excel 2000 Chris Russell Excel Programming 3 September 10th 03 05:32 PM


All times are GMT +1. The time now is 06:42 AM.

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"