×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Excel - Solver - Macro

Excel - Solver - Macro

Excel - Solver - Macro

(OP)
Would appreciate some help on the following:
Creating a Macro that uses the Excel "Solver" function. When I run the Macro it returns with a notice

"Compile error:
Sub or Function not defined."

It highlights "SolverOK" in the code.

If someone could sugest a solution it would be appreciated.

Thanks

RE: Excel - Solver - Macro

A macro cannot run Solver unless VBA knows where to find the Solver's code, and so for each spreadsheet from which you want to run the Solver via a macro you have to tell VBA the magic location.  This is done via what VBA calls "references".

Do the following:
(1) Get into VBA.
(2) Take Tools>References>Browse.
(3) You now need to locate the Solver code.  With a "standard" installation of Office 10, you will find it in the directory
C:\Program Files\Microsoft Office\Office10\Library\Solver
so navigate your way to that location.
(4) The entity you wish to select is SOLVER.XLA and this will normally not be visible unless you activate the "all files" view.
(5) Select SOLVER.XLA and hit "open".

You will now return to the main references screen, where you should see the SOLVER has been added to the list and has been activated.

Other versions of Excel will be basically similar, mutatis mutandis.

RE: Excel - Solver - Macro

...and that kludge is from Microsoft's /best/ programming team (reputedly).

Cheers

Greg Locock

Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Excel - Solver - Macro

Yair.  As the saying goes: "From the wonerful folks who gave you…".

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources