Can't find "Solver"

B

Bill Allen

I'm writing one of my first macros and I would appreciate some help.

I am trying to automate the Solver add-in. I started by using the macro
recorder which generated the following:

Sub SolveForK()
'
' SolveForK Macro
' Macro recorded 1/29/2005 by Bill Allen, S.E.
'
' Keyboard Shortcut: Ctrl+Shift+K
'
SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0", ByChange:="$Q$5"
SolverSolve
End Sub

Question 1:
When I try to execute the code, I get the following error:

With the "SolverOk" highlighted, the error reads:
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Sub or Function not defined
---------------------------
OK Help
---------------------------

What is wrong with the code? What do I need to fix?

Thanks,

Bill
 
K

Ken Wright

Not necessarily - This one is a bit of a catchall. Take a look in the VBA
help files for solver and notice the bit that says

Before you use this function, you must establish a reference to the Solver
add-in. With a Visual Basic module active, click References on the Tools
menu, and then select the Solver.xla check box under Available References.
If Solver.xla doesn't appear under Available References, click Browse and
open Solver.xla in the \Office\Library\Solver\ subfolder.

Does that help?
 
B

Bill Allen

Ken -

That helps a lot. As you may have suspected, the check box was unchecked.

This concept will help when I don't have a code workaround.

I hope I remember with that time comes :blush:).

Regards,

Bill Allen
 
K

Ken Wright

LOL - Having been there myself once it's one of those things you tend to
remember. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top