Hi Mike,
You need to set a reference to the Solver add-in for this to work.
First, make sure Solver is actually open by choosing Tools/Solver from the
Excel menu and then just closing the Solver dialog (the Solver add-in won't
necessarily be open when you first start Excel because it's a demand-loaded
add-in).
Next activate the workbook with your code in it and choose Alt+F11 to
open the Visual Basic Editor. From the VBE menu choose Tools/References. Put
a check mark beside the reference called SOLVER. Save your workbook. The
code should run now.
--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/
* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
"mike allen" wrote in message
...
i recorded a macro while using the solver function, which worked, but when
i
tried to re-use the code that it had recorded, it said "sub or function
not
defined" and highlighted "SolverOk"
sub test()
SolverOk SetCell:="$G$1", MaxMinVal:=3, ValueOf:=".0124", ByChange:="$G$2"
SolverSolve
end sub
any thoughts? thanks, mike allen