Name

range.Value([RangeValueDataType]) [= setting]

Synopsis

Sets or returns the value of the specified range.

Argument

Settings

RangeValueDataType

xlRangeValueDefault returns Empty if the specified range is empty or an array of values if the range contains more than one cell; xlRangeValueMSPersistXML returns the recordset representation of the range in XML format; xlRangeValueXMLSpreadsheet returns the values, formatting, formulas, and names of the specified range in XML spreadsheet format.

The following code returns the values of the specified range in XML format:

ActiveSheet.Range("G1:G5").Value(xlRangeValueMSPersistXML)

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.