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

S

Sean Farrow

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.
 
J

JLGWhiz

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.
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top