XL97: Description of the Value2 Property for the Range ObjectLast reviewed: March 13, 1998Article ID: Q165929 |
The information in this article applies to:
SUMMARYMicrosoft Excel 97 includes a new Visual Basic for Applications property called Value2. The Value2 property, which you can use for the Range object, is almost identical to the Value property except that the Value2 property does not use the Currency and Date data types. Depending on how a cell is formatted (for example, with date, currency, or other formats), the two properties may return different values for the same cell. Note that the Value2 property is not available in earlier versions of Microsoft Excel. Therefore, if a cell is formatted with a currency number format or a date number format, the Value property may not return the expected underlying cell value.
MORE INFORMATIONMicrosoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400. In the following example, the Value and Value2 properties return different results for the same cell object. To see the results, use the following steps:
Currency returned by Value property = 1.2346 Currency returned by Value2 property = 1.23456789 Date returned by Value property = 2/3/97 Date returned by Value2 property = 35431The underlying cell value in cell A1 is 1.23456789, however, the Value property returns 1.2346. This is true because Microsoft Excel stores currency numbers in an integer format that is scaled by 10,000 to produce a fixed-point number with 15 digits to the left of the decimal and 4 digits to the right of the decimal. For cells formatted as currency, the Value2 property returns the actual underlying cell value. The underlying cell value in cell A2 is the serial number for 2/3/97, which is 35431. The Value property returns a date formatted with the short date format. The Value2 property, for cells formatted as a date, returns the underlying serial number for the date.
REFERENCESFor more information about using the Value2 property, click the Office Assistant, type "value2" (without the quotation marks), click Search, and then click to view the "Value2 Property" topic. NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Visual Basic for Applications Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q120802 TITLE : Office: How to Add/Remove a Single Office Program or Component |
Additional query words: XL97
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |