ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Solver Macro in Excel 2007 (https://www.excelbanter.com/excel-programming/393042-solver-macro-excel-2007-a.html)

jswirhun

Solver Macro in Excel 2007
 
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

Tom Ogilvy

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



All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com