SETF function

Microsoft Office ShapeSheet

SETF function

See also

Sets a cell's formula.

Syntax

SETF( GETREF(cell), formula)

SETF(GETREF(cell), "formula")

SETF(GETREF(cell), """formula""")

SETF("cell",formula)

SETF("cell","formula")

SETF("cell","""formula""")

Remarks

When evaluated, the result of the expression in formula becomes the new formula in cell. If formula is enclosed in quotation marks, the quoted expression is written to cell. To set cell to a string, enclose formula in three sets of quotation marks.

The target cell must be specified using a GETREF() reference or as a string to avoid circularity. Using GETREF is preferred, because Microsoft Visio can adjust references when the shape is moved to a different document.

If cell is not specified using GETREF or as a string, the function returns an error, and no cell's formula is changed. If formula contains a syntax error, the function returns an error, and the formula in cell is not changed.

Example 1

SETF( GETREF(Scratch.A1), 1.5in.*6+1ft.)

Sets the formula of Scratch.A1 to 21 in.

Example 2

SETF( GETREF(Scratch.A1), "1.5in.*6+1ft.")

Sets the formula of Scratch. A1 to the expression 1.5 in.*6+1ft.

Example 3

SETF( GETREF(Scratch.A1), """Say """"ahh""""""")

Sets the formula of Scratch.A1 to the string "Say ""ahh""" which evaluates to Say "ahh".