Solver-Macro loop
Solver-Macro loop
(OP)
I have a macro on my worksheet (this is acutualy a button, but I have found which macro this is running).
Say this macro is "xyz" which gives me a result on cell A1. The macro uses B1 as an input to compute A1.
That is, the macro is excecutable with the following piece of code:
Application.Run "mybook.xls! xyz"
Now, I would like to run the "Solver" package on A1, such that it gives a value of say 5.
How can I achive this feat? I use the following code for Solver:
SolverReset
SolverOk SetCell:="A1", MaxMinVal:=3, ValueOf:="5", ByChange:="B1"
Call SolverSolve
SolverFinish
Obviously, the problem is that "mybook.xls! xyz" is not run during the solver optimization stage,
and hence I do not get any result?
Any ideas on how to make this work? I tried the INDIRECT function, but this does not seem to run
my macro.
Many thanks for your help!
Say this macro is "xyz" which gives me a result on cell A1. The macro uses B1 as an input to compute A1.
That is, the macro is excecutable with the following piece of code:
Application.Run "mybook.xls! xyz"
Now, I would like to run the "Solver" package on A1, such that it gives a value of say 5.
How can I achive this feat? I use the following code for Solver:
SolverReset
SolverOk SetCell:="A1", MaxMinVal:=3, ValueOf:="5", ByChange:="B1"
Call SolverSolve
SolverFinish
Obviously, the problem is that "mybook.xls! xyz" is not run during the solver optimization stage,
and hence I do not get any result?
Any ideas on how to make this work? I tried the INDIRECT function, but this does not seem to run
my macro.
Many thanks for your help!





RE: Solver-Macro loop
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Solver-Macro loop
Cheers,
Joerd
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: Solver-Macro loop
Sorry for the late reply.
>Is this for school?
Quite insulting :)
No, I have a doctorate in engineering and I have done enough time at school :)
XLNew.