Spread for ASP.NET 7.0 Product Documentation
GoalSeek Method
See Also  Example Support Options
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : GoalSeek Method


variableRow
Row index of cell that contains value to adjust
variableColumn
Column index of cell that contains value to adjust
formulaDataModel
Data model of cell that contains formula
formulaRow
Row index of cell that contains formula
formulaColumn
Column index of cell that contains formula
desiredResult
Formula result you wish to achieve

Glossary Item Box

Attempts to find a value for one cell that produces the desired formula result in another cell.

Syntax

Visual Basic (Declaration) 
Public Function GoalSeek( _
   ByVal variableRow As Integer, _
   ByVal variableColumn As Integer, _
   ByVal formulaDataModel As DefaultSheetDataModel, _
   ByVal formulaRow As Integer, _
   ByVal formulaColumn As Integer, _
   ByVal desiredResult As Double _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetDataModel
Dim variableRow As Integer
Dim variableColumn As Integer
Dim formulaDataModel As DefaultSheetDataModel
Dim formulaRow As Integer
Dim formulaColumn As Integer
Dim desiredResult As Double
Dim value As Boolean
 
value = instance.GoalSeek(variableRow, variableColumn, formulaDataModel, formulaRow, formulaColumn, desiredResult)

Parameters

variableRow
Row index of cell that contains value to adjust
variableColumn
Column index of cell that contains value to adjust
formulaDataModel
Data model of cell that contains formula
formulaRow
Row index of cell that contains formula
formulaColumn
Column index of cell that contains formula
desiredResult
Formula result you wish to achieve

Example

This example uses the GoalSeek method.
C#Copy Code
FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
FpSpread1.Sheets[0].Cells[1, 1].Formula = "C1+D1";
FpSpread1.Sheets[0].Cells[0, 3].Value = 2;
dataModel.GoalSeek(0, 2, dataModel, 1, 1, 32);
Visual BasicCopy Code
Dim dataModel As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(5, 5)
FpSpread1.ActiveSheetView.DataModel = dataModel
FpSpread1.Sheets(0).Cells(1, 1).Formula = "C1+D1"
FpSpread1.Sheets(0).Cells(0, 3).Value = 2
dataModel.GoalSeek(0, 2, dataModel, 1, 1, 32)

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.