Microsoft KB Archive/213689

= Compile error occurs running a recorded macro that uses the Solver add-in =

Article ID: 213689

Article Last Modified on 1/24/2007

-

APPLIES TO


 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition
 * Microsoft Excel 2000 Standard Edition
 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q213689



This article is a consolidation of the following previously available article: 171750



SYMPTOMS
When you run a Visual Basic for Applications macro that you created by using the macro recorder, you may receive the following error message:

Compile error:

Sub or Function not defined.



CAUSE
This behavior can occur when you run a recorded macro that uses the Solver add-in but you do not reference the Solver add-in.



RESOLUTION
To resolve the problem, create a reference to the Solver add-in. To do so, follow these steps:  In Microsoft Excel, start the Visual Basic Editor (press ALT+F11). On the Tools menu, click References. Click to select the Solver check box, and then click OK.

Note If Solver is not in the list of references, make sure that it is enabled. To do this, follow these steps in Excel:  On the Tools menu, click Add-Ins. Click to select Solver Add-in, and then click OK.</ol> </li></ol>

The next time that you run the macro, this behavior does not occur.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

<div class="references_section">