XL97: Unexpected Results Using the SolverAdd Function

Last reviewed: March 13, 1998
Article ID: Q162259
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

In Microsoft Excel 97, when you execute the SolverAdd function to programmatically add a constraint in your Solver model, the constraint is not added.

CAUSE

This problem may occur if you use R1C1 notation for the "FormulaText" argument of the SolverAdd function. In Microsoft Excel 97, the "FormulaText" argument for SolverAdd will execute successfully only when specified in A1 notation.

NOTE: In earlier versions of Microsoft Excel, when you added a constraint to a problem with the Visual Basic function SolverAdd, you were required to specify the right side of the equation (the "FormulaText" argument) in R1C1 notation. If you did not specify the "FormulaText" argument in R1C1 notation, the constraint was not added. This has changed in Microsoft Excel 97 and now the opposite is true.

WORKAROUND

For example, the following line will not add a constraint to a Solver model in Microsoft Excel 97:

   SolverAdd CellRef:=Range("$A$1"), Relation:=1, FormulaText:="R1C2"

To correct this problem, change the FormulaText argument to A1 notation, as in the following example:

   SolverAdd CellRef:=Range("$A$1"), Relation:=1, FormulaText:="$B$1"
C:\MSOffice\Excel\Libary\Solver\.


Additional query words: 97 XL97 addin
Keywords : kbcode kbprg xlvbainfo xladdins
Version : WINDOWS:97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.