XLnew
Computer
- Dec 21, 2008
- 12
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!