Excel - difference between Value and Value2 and obtaining the value of a cell in excel xp and later

Asked By Sean Farrow on 12-Jan-09 12:19 PM
Hi:
What is the difference between Value and Value2 when refering to to a range
or cell.
Secondly in excel xp and later (from the excel type library) there are three
parameters, a lcid, an out parameter for the value and another parameter,
RangeDataType, what is this parameters purpose.
Any help apreciated.
Sean.




JLGWhi replied on 12-Jan-09 12:48 PM
From where are you getting these parameters?  The difference between Value
and Value2 is that Value2 always uses the same value that Excel uses.  It
does not truncate decimal places like when you divide 22 by 7 and format the
cell for 2 decimal places, value 2 will give you the maximum number of
decimal places in doing the calculation.

lcic or LCID, is Locale Code Identification or Language Code Identification,
a code that when inserted into a code line, tells it how to display the
results.  I thnk -406 is U.S.(English).

I don't know what the other is.
Dave Peterson replied on 12-Jan-09 02:43 PM
VBA's help for .value2 describes the differences.  It's useful for working with
dates and currencies.

Put a date in a cell and show the .value and .value2 properties in a msgbox.
Try it with a cell formatted for currency.  (Put a value of 123.435213 in that
cell.)

From xl2003's help for .value:

Value property as it applies to the Range object.

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

expression.Value(RangeValueDataType)
expression    Required. An expression that returns a Range object.

RangeValueDataType   Optional Variant. The range value data type. Can be a
xlRangeValueDataType constant.

xlRangeValueDataType can be one of these xlRangeValueDataType constants.

xlRangeValueDefault    default If the specified Range object is empty, returns
the value Empty (use the IsEmpty function to test for this case). If the Range
object contains more than one cell, returns an array of values (use the IsArray
function to test for this case).

xlRangeValueMSPersistXML    Returns the recordset representation of the
specified Range object in an XML format.

xlRangeValueXMLSpreadsheet    Returns the values, formatting, formulas and names
of the specified Range object in the XML Spreadsheet format.

=======
I don't know what lcid is.



--

Dave Peterson