Range.GoalSeek Method
Calculates the values necessary to achieve a specific goal.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function GoalSeek ( _
Goal As Object, _
ChangingCell As Range _
) As Boolean
'Usage
Dim instance As Range
Dim Goal As Object
Dim ChangingCell As Range
Dim returnValue As Boolean
returnValue = instance.GoalSeek(Goal, _
ChangingCell)
bool GoalSeek(
Object Goal,
Range ChangingCell
)
Parameters
Goal
Type: System.ObjectRequired Object. The value you want returned in this cell.
ChangingCell
Type: Microsoft.Office.Interop.Excel.RangeRequired Range. Specifies which cell should be changed to achieve the target value.
Return Value
Type: System.Boolean
Remarks
If the goal is an amount returned by a formula, this calculates a value that, when supplied to your formula, causes the formula to return the number you want.
This method returns True if the goal seek is successful.