Search Results for

    Show / Hide Table of Contents

    ExcelFile.RecalcRange Method

    This method recalculates a formula that returns a range, and returns the cells that compose it. Note that normally ranges are a single rectangle (like in "=A1:B2"), and in this case this method will return a single element in the array. But you might have a formula like "=A1:A10, C6:C7" which will return two different ranges. In this case, the returned array will have more than one TCellAddressRange. If the formula doesn't resolve to a range or group of ranges, this method will return null.

    Syntax

    Namespace: FlexCel.Core

    public abstract TCellAddressRange[] RecalcRange(Int32 activeSheet, Int32 activeRow, Int32 activeCol, Int32 rowOffset, Int32 colOffset, String expression, Boolean forced, Boolean relativeReferences)

    Parameters

    <-> Parameter Type Description
    activeSheet Int32 Sheet where you are positioned when doing the calculation. You might pass xls.ActiveSheet here.
    activeRow Int32 Row where you are positioned when doing the calculation. This only matters if you have functions that change depending on the cell you are in. (Mainly =Row() and =Column() functions).
    If you are not sure, specify 1 here.
    activeCol Int32 Column where you are positioned when doing the calculation. This only matters if you have functions that change depending on the cell you are in. (Mainly =Row() and =Column() functions).
    If you are not sure, specify 1 here.
    rowOffset Int32 Offset from the first cell of a range. This only matters if you have relative references that change depending on the cell you are in. (This is the case with named ranges or data validations and relative references like A1 instead of $A$1).
    If you are not sure, specify 0 here.
    colOffset Int32 Offset from the first cell of a range. This only matters if you have relative references that change depending on the cell you are in. (This is the case with named ranges or data validations and relative references like A1 instead of $A$1).
    If you are not sure, specify 0 here.
    expression String Formula to evaluate. It must start with "=", be a valid Excel formula and resolve to a range of cells.
    forced Boolean When true this method will always perform a recalc. When false, only if there has been a change on the spreadsheet.
    While for performance reasons you will normally want to keep this false, you might need to set it to true if the formulas refer to functions like "=NOW()" or "=RANDOM()" that change every time you recalculate.
    relativeReferences Boolean Specifies if the references in the formula are relative to the cell where the cursor is positioned or not. Formulas in data validations, name definitions and conditional formats are relative and should have this parameter set to true. Formulas in cell are not relative, and should have this parameter set to false.

    Returns

    The array of ranges that the formula refers to.

    See also

    • ExcelFile
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com