Solver - VBA not running

Mariner191

Board Regular
Joined
Dec 14, 2007
Messages
123
Mr. Excel,

Attempting to run macro to automate a Solver.
Code errors out on the first appearance of "SolverOk"
SolverOk SetCell:="$U$6",

Error message indicates "Compile Error: Sub or Function not defined".
Please advise.

Thank you in advance,
Mariner191
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi,

First, make sure that the Solver add-in is installed (in the main Excel interface go via Tools | Add-Ins).
Next, in the VBE go to Tools | References and tick the SOLVER reference.

For more information see here:
http://peltiertech.com/Excel/SolverVBA.html


Hope that helps...
 
Upvote 0

Mariner191

Board Regular
Joined
Dec 14, 2007
Messages
123
Colin_L,

Your solution was on target.
1. VBE go to Tools | References and tick the SOLVER reference
2. Start the code with SolverReset
3. End the code with SolverSolve True

Thank you!
Mariner191
 
Upvote 0

Forum statistics

Threads
1,190,561
Messages
5,981,695
Members
439,730
Latest member
gjvv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top