Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Excel / September 2007



Tip: Looking for answers? Try searching our database.

How to run solver from a macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Skin Paul - 12 Sep 2007 16:10 GMT
Hi all, Using xl 2004 v.11.3.5 - Mac OS 10.4.10
I am trying to run solver from a macro but not having much luck.
If I select solver from the menu and input the right info and click solve
It works fine. When I run solver via a macro I get a compile error - Sub or
Function not defined.Below is where I"m at. Any pointers to my mistake
please.

Sub Solve()

SolverOk SetCell:="$G$18", MaxMinVal:=3, ValueOf:="510", ByChange:="$C$18"
   SolverSolve
End Sub

SolverOk Gets highlighted but I don't know what next to do.
Thanks Paul
JE McGimpsey - 12 Sep 2007 18:08 GMT
> Hi all, Using xl 2004 v.11.3.5 - Mac OS 10.4.10
> I am trying to run solver from a macro but not having much luck.
> If I select solver from the menu and input the right info and click solve
> It works fine. When I run solver via a macro I get a compile error - Sub or
> Function not defined.Below is where I"m at. Any pointers to my mistake
> please.

XL doesn't have any idea what "SolverOK" means, because it isn't a
built-in function. You need to set a reference to the Solver Add-in.

One way:

In XL, Choose Tools/Solver...  Click Close.

In the Visual Basic Editor, click Reset. Choose Tools/References. In the
dialog that opens, check the Checkbox next to Solver. Click OK and save
your workbook.

Now when you open your workbook, XL will load Solver.xla as well, and
your code will compile fine.

As an alternative, you can put an alias from Solver.xla (found in

   HD:Applications:Microsoft Office 2004:Office:Add-Ins

into your startup folder (by default

   HD:Applications:Microsoft Office 2004:Office:Startup:Excel

but you can specify a different folder in Preferences/General). Then
Solver.xla will open every time you open XL and its functions will
always be available for you to set a reference to.
Skin Paul - 13 Sep 2007 03:32 GMT
Thanks J.E.   You came through once again.  Paul

On 13/9/07 3:08 AM, in article
jemcgimpsey-86F89A.11081812092007@msnews.microsoft.com, "JE McGimpsey"
<jemcgimpsey@mvps.org> wrote:

>> Hi all, Using xl 2004 v.11.3.5 - Mac OS 10.4.10
>> I am trying to run solver from a macro but not having much luck.
[quoted text clipped - 28 lines]
> Solver.xla will open every time you open XL and its functions will
> always be available for you to set a reference to.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.