Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Range.Value Property

Office 2007
Returns or sets a Variant value that represents the value of the specified range.



expression   A variable that represents a Range object.


NameRequired/OptionalData TypeDescription
RangeValueDataTypeOptionalVariantThe range value data type. Can be a xlRangeValueDataType constant.


When setting a range of cells with the contents of an XML spreadsheet file, only values of the first sheet in the workbook are used. You cannot set or get a discontiguous range of cells in the XML spreadsheet format.


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

Visual Basic for Applications
Worksheets("Sheet1").Range("A1").Value = 3.14159

This example loops on cells A1:D10 on Sheet1. If one of the cells has a value less than 0.001, the code replaces the value with 0 (zero).

Visual Basic for Applications
For Each c in Worksheets("Sheet1").Range("A1:D10")
    If c.Value < .001 Then
        c.Value = 0
    End If
Next c

Community Additions

© 2015 Microsoft