HotXLS Docs

Value property

Returns or sets the value of the specified range. Read/write Variant.

Syntax

property Value: Variant;

Remarks

If the cell contains a constant, this property returns the constant. If the cell contains a Formula, the Value property returns calculated result of Formula. If the range is a one- or two-dimensional range, you can set the Value to a Variant Array of the same dimensions. Similarly, the Value property returns the Variant Array. Setting the Value for a multiple-cell range fills all cells in the range with the value.

Example

This example sets the value of cell A1 on sheet one to 3.14159.

Workbook.Sheets[1].Range['A1', 'A1'].Value := 3.14159;
This example is the same to previous.

Workbook.Sheets[1].Cells.Item[1, 1].Value := 3.14159;
This example is the same to previous.

Workbook.Sheets[1].Cells[1, 1].Value := 3.14159;
This example sets the value of cell A1 on sheet one to PI.

Workbook.Sheets[1].Range['A1', 'A1'].Value := '=PI()';
This example copies the values from A1:F1 range to A2:F2 range.

With Workbook.Sheets[1] do begin
  Range['A2', 'F2'].Value := Range['A1', 'F1'].Value;
end;
This example is the same to previous.

With Workbook.Sheets[1].Range['A1', 'F1'] do
    Offset[1,0].Value := Value;
This example demonstrates using of Formulas.

With Workbook.Sheets[1] do begin
  Range['B1', 'B1'].Value := '=(A1/100)*20';
  Range['B2', 'B2'].Value := '=SUM(A1:B1)';
  Range['B3', 'B3'].Value := '=PI()*A3^2/2';
end;