Calculates the values necessary to achieve a specific goal.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
- Type: System.Object
The value you want returned in this cell.
- Type: Microsoft.Office.Interop.Excel.Range
Specifies which cell should be changed to achieve the target value.
Return ValueType: System.Boolean
true if the goal seek is successful; otherwise, false.
The following code example sets a formula in a NamedRange control, and then uses the method to determine which value for X in the formula will return the value 15. The example places the answer in cell B1.
This example is for a document-level customization.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.