Partager via


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.Object

    Required Object. The value you want returned in this cell.

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.

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Excel Namespace