Returns o sets the cell's Formula. Read/write Variant
Syntax
proprietà Formula: Variant;
Remarks
If the cell contains a constant, this proprietà returns the constant.
If the cell contains a Formula, the Formula proprietà returns the Formula as a string (including the equal sign).
If the range is a one- o two-dimensional range, you can set the Formula to a Variant Array of the same dimensions.
Similarly, the Formula proprietà returns the Variant Array.
L'impostazione della Formula per un intervallo di più celle riempie tutte le celle dell'intervallo con la Formula
HotXLS's Formula compiler use the semicolon sign instead of comma as the funzione argument separator
book.Sheets[1].Cells[2,3].Formula := '=IF(A1>100;A1*B1;A1*B2)';
Example
This example sets the Formula of cell A2 e obtains the result of Formula into Val variable
With Workbook.Sheets[1] do begin
Cells[1,1].Value := 100;
Cells[2,1].Formula := '=IF(A1>70;A1/2;A1)';
Val := Cells[2,1].Value; //Val = 50
end;
This example copies the Formulas from A1:F1 range to A2:F2 range