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?
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!
Bookmarks