View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Solver Macro in Excel 2007

have you created a reference to the solver addin?

http://support.microsoft.com/kb/843304
even though for an earlier version of Excel, may shed some light.

--
Regards,
Tom Ogilvy


"jswirhun" wrote:

I recorded a Macro in Excel 2007 that uses the Solver, so I have macros
enabled and security set to low, and I have installed the Solver Add-In, but
when I run the recorded Macro, an Error Message comes up:

Compile Error:
Sub or Function not defined.

Here is the code, but I can't see how it could have a problem if Excel
recorded it.

Sub FindEquation()
'
' FindEquation Macro
'

'
SolverOk SetCell:="$K$4", MaxMinVal:=2, ValueOf:="0", ByChange:= _
"$G$4,$H$4,$I$4"
SolverSolve
SolverOk SetCell:="$L$4", MaxMinVal:=2, ValueOf:="0", ByChange:= _
"$G$4,$H$4,$I$4"
SolverSolve
SolverOk SetCell:="$K$4", MaxMinVal:=2, ValueOf:="0", ByChange:= _
"$G$4,$H$4,$I$4"
SolverSolve
End Sub

Any suggestions?
Thanks