Compile Error Sub Or Function Not Defined Solver
Contents |
SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content compile error sub or function not defined vba Samples We’re sorry. The content you requested has been removed. You’ll be auto
Compile Error Sub Or Function Not Defined In Excel Macro
redirected in 1 second. Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From compile error sub or function not defined access My Forums Answered by: Sub or Function not defined Microsoft ISV Community Center > Visual Basic for Applications (VBA) Question 1 Sign in to vote I came accross a strange problem. I tried compile error sub or function not defined excel 2010 to record a macro where I used Solver. After I tried to run it, I was given an error message:  Compile Error: Sub or Function not defined.  The function where VBA stops is "SolverOK". It is not a macro that I coded, I recorded it in the excell sheet.  Thanks for any advice. Lubomir   -------------------------------------------------------------------------- Code that was generated is obviously correct:
Solver Vba No Dialog Box
 Sub solver()' solver Macro' Macro recorded 26/07/2007 by Z05041K   SolverOk SetCell:="$B$115", MaxMinVal:=3, ValueOf:="0", ByChange:="$B$91"   SolverSolveEnd Sub Thursday, July 26, 2007 9:27 AM Reply | Quote Answers 2 Sign in to vote Hi,You need to include a reference to SOLVER.XLAWith VBE use menu Tools > References. Check the Solver reference. Proposed as answer by ryguy72 Saturday, August 09, 2014 2:28 PM Marked as answer by danishaniModerator Tuesday, September 16, 2014 5:30 AM Thursday, July 26, 2007 6:10 PM Reply | Quote All replies 2 Sign in to vote Hi,You need to include a reference to SOLVER.XLAWith VBE use menu Tools > References. Check the Solver reference. Proposed as answer by ryguy72 Saturday, August 09, 2014 2:28 PM Marked as answer by danishaniModerator Tuesday, September 16, 2014 5:30 AM Thursday, July 26, 2007 6:10 PM Reply | Quote 0 Sign in to vote I have the same problem.  OK, found this in VB Help  SolverOk Function  Defines a basic Solver model. Equivalent to clicking Solver on the Tools menu and then specifying options in the Solver Parameters dialog box. Before you use this function, you must establish a reference to the Solver add-in. With a Visual
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more solverok compile error about Stack Overflow the company Business Learn more about hiring developers or posting ads solverok setcell with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Vba Tools References Not Available
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Excel VBA: Compile Error: Sub of Function not Defined up vote 1 https://social.msdn.microsoft.com/Forums/en-US/2a0a5859-b688-42f5-a953-97fd9f85d4c8/sub-or-function-not-defined?forum=isvvba down vote favorite I'm trying to solve a problem with the following code but I just can't find a way around it. Whenever I try the Macro, I get an error "Sub or Function not defined". and the debugger highlights in yellow "Sub Solver_Overtime() and highlights in blue "SolverRest" Sub Solver_OverTime() Application.ScreenUpdating = False Sheets("OverTime").Activate SolverReset SolverOptions MaxTime:=100, _ Iterations:=100, _ Precision:=0.000001, _ AssumeLinear:=True, _ StepThru:=False, _ Estimates:=1, _ http://stackoverflow.com/questions/21915646/excel-vba-compile-error-sub-of-function-not-defined Derivatives:=1, _ SearchOption:=1, _ IntTolerance:=5, _ Scaling:=False, _ Convergence:=0.0001, _ AssumeNonNeg:=True SolverAdd CellRef:="NET", Relation:=3, FormulaText:="NET_LIMIT" SolverAdd CellRef:="shftCount", Relation:=1, FormulaText:="shftCountLimit" SolverAdd CellRef:="schTemplate", Relation:=4, FormulaText:="integer" SolverOk setcell:=Sheets("OverTime").Range("Intervals[[#Totals],[OT]]"), MaxMinVal:=2, ValueOf:="0", ByChange:=Sheets("OverTime").Range("Template_Schedule[COUNT]") 'SolverOk SetCell:="TargetCell", MaxMinVal:=2, ValueOf:="0", ByChange:="schTemplate" SolverSolve True End Sub I'm not certain what the problem is because it runs just fine on another computer. Thanks in advance. excel vba excel-vba share|improve this question asked Feb 20 '14 at 17:48 BlueSun3k1 1863620 4 Did you add a reference to the Solver library? (Tools>References>Solver) –Tim Williams Feb 20 '14 at 17:56 @pnuts that was a typo, it's SolverReset. –BlueSun3k1 Feb 20 '14 at 18:01 1 @Tim Williams: I did not but now I did and it works. Thank you, that takes care of the issue. –BlueSun3k1 Feb 20 '14 at 18:01 1 @user1582396 do make it an answer and accept it please. –nawfal Sep 22 '14 at 13:14 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted I followed up on Tim William's instructions to add a Reference to the Solver Library by going to Tools > References > Solver. It did the job and it works as intended. share|improve this answer answered Sep 23 '14 at 3:41 BlueSu
Forums Excel Questions Compile Error When Running VBA Solver Results 1 to 3 http://www.mrexcel.com/forum/excel-questions/545612-compile-error-when-running-visual-basic-applications-solver.html of 3 Compile Error When Running VBA SolverThis is http://www.teachexcel.com/excel-help/excel-how-to.php?i=147803 a discussion on Compile Error When Running VBA Solver within the Excel Questions forums, part of the Question Forums category; Can anyone help? I keep receiving a Compile Error: Sub or Function not defined when I try to run compile error a ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Apr 23rd, 2011,02:04 AM #1 SteveFrancis New Member Join Date Apr 2011 compile error sub Posts 2 Compile Error When Running VBA Solver Can anyone help? I keep receiving a Compile Error: Sub or Function not defined when I try to run a macro that runs solver. The Sub RunSolverLibContent() ' ' RunSolverLibContent Macro ' ' SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$F$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$F$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$F$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverSolve SolverOk SetCell:="$G$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$G$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$G$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$G$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverSolve SolverOk SetCell:="$H$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$H$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$H$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$H$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverSolve SolverOk SetCell:="$I$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$I$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$I$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$I$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverSolve SolverOk SetCell:="$J$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$J$35", Engine _ :=1, EngineDesc:="GRG Nonlinear" SolverOk SetCell:="$J$32", MaxMinVal:=3, ValueOf:=0, ByChange:="$J$35", Engine _ :=1, EngineDesc:="GRG N
Get Your Free Excelebook! Our Top 15 Excel Tutorials Instant Access! E-mail: Download Link: Top 15 Excel Tutorials Excel Tutorials Free Excel Macros Keyboard Shortcuts Excel Forum Contact Subscribe for Free Excel tips & more! E-mail: Advertisements Compile Error: Sub Or Function Not Defined Search Excel Forum Posts, Tutorials, Macros, Tips, and More New Excel Help Service! We need your input to help create a new Live Online Excel Help service. Please take our survey and let us know your thoughts! Excel Survey Have a great day!Don Similar Topics | Similar Excel Tutorials | Helpful Excel Macros Compile Error: Sub Or Function Not Defined - Excel View Answers I've started to record a simple macro to automate the use of Solver however the macro will not run due to the error message "Compile error: Sub or Function not defined" (see attached). The macro doesn't start and stops with the first line highlighted "SolverReset". Other macros with similar use of Solver do not have a problem. Appreciate any help regarding this problem. Code: Sub Macro1() ' SolverReset SolverOk SetCell:="$C$81", MaxMinVal:=2, ValueOf:="0", ByChange:="$C$59:$C$64" SolverAdd CellRef:="$C$84", Relation:=2, FormulaText:="sum($C$85:$C$89)" SolverOk SetCell:="$C$81", MaxMinVal:=2, ValueOf:="0", ByChange:="$C$59:$C$64" SolverSolve End Sub Similar Excel Tutorials Remove Vlookup #N/A Error in Excel How to remove the #N/A error from Vlookup and replace it with a friendly message or a blank cell. Fix the Vlookup ... Prevent Errors From Appearing in Excel How to prevent errors from appearing in formulas in Excel. This is especially helpful for the Vlookup function. Sec ... Enter a Constant Value in a Defined Name in Excel - Text, Numbers, Formulas, Etc. In Excel you can store values in Defined Names. Often people use a Defined Name to refer to a cell on a worksheet ... List All Defined Names and Values in the Worksheet in Excel Quickly list all Defined Names and their Values in the worksheet without using a mac