Version

SetColumnFormula(Formula,Boolean) Method

Sets the formula to use in the data cells in the column.
Syntax
'Declaration
 
Public Sub SetColumnFormula( _
   ByVal formula As Formula, _
   ByVal overwriteExistingValues As Boolean _
) 
public void SetColumnFormula( 
   Formula formula,
   bool overwriteExistingValues
)

Parameters

formula
The formula for the data cells of the column or null to remove the current column formula.
overwriteExistingValues
True to overwrite the existing cells values and apply the formula to all data cells in the column. False to only apply the formula to the cells with no value set.
Exceptions
ExceptionDescription
System.ArgumentExceptionIf column was removed from the table.formula is already applied to something else, such as a cell or table column.
System.InvalidOperationExceptionIf column was removed from the table.
Remarks

If any relative cell or region references are in the specified formula, it will be assumed that the actual formula is being applied to the first data cell in the column. When the formula is applied to other cells in the column, the relative references will be offset by the appropriate amount.

When the column formula is set and the table is resized to give it more rows, the new cells in the column will have the column formula applied to them.

If there was a different column formula applied previously and it was applied to any of the cells in the column, setting it to a different formula will overwrite the formulas on those cells, regardless of the value of overwriteExistingValues.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also