Skip to content
Sheetwrite

@sheetwrite/wasm

moveFormulaCellsfunction

Report a problem

On this page

Follow a block of cells cut and pasted on the formula's own sheet, as Excel's Cut and Paste moves the references of a formula: a reference to a moved cell follows it, one to a cell the block lands on becomes #REF!. A conditional-format rule that moves with the block uses it.

Declaration

function moveFormulaCells(
source: string,
row: number,
col: number,
rows: number,
cols: number,
to_row: number,
to_col: number,
shift: boolean,
): string

Parameters

source: stringrequired

Formula text on the sheet of the moved block.

row: numberrequired

Zero-based first row of the block before the move.

col: numberrequired

Zero-based first column of the block before the move.

rows: numberrequired

Rows in the block.

cols: numberrequired

Columns in the block.

to_row: numberrequired

Zero-based first row of the block after the move.

to_col: numberrequired

Zero-based first column of the block after the move.

shift: booleanrequired

true for Excel's Insert or Delete with Shift cells: references follow the rule of inserted and deleted cells.

Returns

string

The formula with its references adjusted; the text unchanged when it can't be read as a formula.

Referenced by

Public exports naming moveFormulaCells